From 4594899114c59386b41c3daa3249ab3d89792ca1 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Sun, 29 Sep 2019 14:58:02 +0200 Subject: csi: ignore invalid scrolling regions There must be at least one scrolling row. I.e. the bottom margin must be larger than the top margin. Note that trying to set an invalid region really will be *ignored*. I.e. we *don't* reset the scrolling region. This conforms to xterm's behavior. --- csi.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/csi.c b/csi.c index f6f890e3..a7892e9a 100644 --- a/csi.c +++ b/csi.c @@ -617,15 +617,18 @@ csi_dispatch(struct terminal *term, uint8_t final) int start = vt_param_get(term, 0, 1); int end = min(vt_param_get(term, 1, term->rows), term->rows); - /* 1-based */ - term->scroll_region.start = start - 1; - term->scroll_region.end = end; + if (end > start) { - term_cursor_to(term, start - 1, 0); + /* 1-based */ + term->scroll_region.start = start - 1; + term->scroll_region.end = end; - LOG_DBG("scroll region: %d-%d", - term->scroll_region.start, - term->scroll_region.end); + term_cursor_to(term, start - 1, 0); + + LOG_DBG("scroll region: %d-%d", + term->scroll_region.start, + term->scroll_region.end); + } break; } -- cgit v1.3