aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--csi.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/csi.c b/csi.c
index ed643090..68825760 100644
--- a/csi.c
+++ b/csi.c
@@ -798,7 +798,8 @@ csi_dispatch(struct terminal *term, uint8_t final)
* ECMA-48, the behaviour is undefined if REP was
* _not_ preceded by a graphical character.
*/
- int count = vt_param_get(term, 0, 1);
+ const size_t max_count = term->grid->num_rows * term->cols;
+ int count = min(vt_param_get(term, 0, 1), max_count);
LOG_DBG("REP: '%lc' %d times", (wint_t)term->vt.last_printed, count);
int width;