aboutsummaryrefslogtreecommitdiff
path: root/csi.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2019-09-29 12:58:02 +0000
committerDaniel Eklöf <daniel@ekloef.se>2019-09-29 12:58:02 +0000
commit4594899114c59386b41c3daa3249ab3d89792ca1 (patch)
tree31e5f345109fe3d87fbfa6ea69c19c4a51127ad2 /csi.c
parentfont: calculate underline/strikeout metrics in font, not main (diff)
csi: ignore invalid scrolling regions0.9.0
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.
Diffstat (limited to 'csi.c')
-rw-r--r--csi.c17
1 files 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;
}