From 42c2791182bc2b801c0a219271f5c1f1048a49af Mon Sep 17 00:00:00 2001 From: Andrew Mayorov Date: Fri, 29 May 2020 20:36:30 +0300 Subject: [PATCH] Do not cap repetitions by row length Instead cap by 65535 as a safeguard. This is more in line with ECMA 48. --- kitty/screen.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kitty/screen.c b/kitty/screen.c index 12bd45715..96c61e74c 100644 --- a/kitty/screen.c +++ b/kitty/screen.c @@ -28,6 +28,8 @@ static const ScreenModes empty_modes = {0, .mDECAWM=true, .mDECTCEM=true, .mDECARM=true}; static Selection EMPTY_SELECTION = {{0}}; +#define CSI_REP_MAX_REPETITIONS 65535u + // Constructor/destructor {{{ static inline void @@ -1257,7 +1259,7 @@ screen_repeat_character(Screen *self, unsigned int count) { unsigned int x = self->cursor->x; if (count == 0) count = 1; if (top <= self->cursor->y && self->cursor->y <= bottom && x > 0) { - unsigned int num = MIN(count, self->columns - x); + unsigned int num = MIN(count, CSI_REP_MAX_REPETITIONS); linebuf_init_line(self->linebuf, self->cursor->y); uint32_t ch = line_get_char(self->linebuf->line, x - 1); if (is_ignored_char(ch) || is_combining_char(ch)) {