Cursor up and down should be limited by the scroll region (cuu should stop at

the scroll region top if starting from below it and cud stop at the bottom if
starting from above). Fixes another vttest test.
This commit is contained in:
Nicholas Marriott 2009-07-09 17:57:11 +00:00
parent 81181bfb72
commit 5f2f07ed8a

View File

@ -232,8 +232,15 @@ screen_write_cursorup(struct screen_write_ctx *ctx, u_int ny)
if (ny == 0) if (ny == 0)
ny = 1; ny = 1;
if (s->cy < s->rupper) {
/* Above region. */
if (ny > s->cy) if (ny > s->cy)
ny = s->cy; ny = s->cy;
} else {
/* Below region. */
if (ny > s->cy - s->rupper)
ny = s->cy - s->rupper;
}
if (ny == 0) if (ny == 0)
return; return;
@ -249,8 +256,15 @@ screen_write_cursordown(struct screen_write_ctx *ctx, u_int ny)
if (ny == 0) if (ny == 0)
ny = 1; ny = 1;
if (s->cy > s->rlower) {
/* Below region. */
if (ny > screen_size_y(s) - 1 - s->cy) if (ny > screen_size_y(s) - 1 - s->cy)
ny = screen_size_y(s) - 1 - s->cy; ny = screen_size_y(s) - 1 - s->cy;
} else {
/* Above region. */
if (ny > s->rlower - s->cy)
ny = s->rlower - s->cy;
}
if (ny == 0) if (ny == 0)
return; return;