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.
This commit is contained in:
Daniel Eklöf 2019-09-29 14:58:02 +02:00
parent 5a0bb292ee
commit 4594899114
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

17
csi.c
View file

@ -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;
}