aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2009-07-09 18:08:13 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2009-07-09 18:08:13 +0000
commit664a0bd55925a741ee642ba8b7fe13e929daa7c8 (patch)
tree9b21e6450a85532f499258c3c0f8e23ad3465cf0
parent4422b958c321596f463f1de74732418e88965134 (diff)
downloadrtmux-664a0bd55925a741ee642ba8b7fe13e929daa7c8.tar.gz
rtmux-664a0bd55925a741ee642ba8b7fe13e929daa7c8.tar.bz2
rtmux-664a0bd55925a741ee642ba8b7fe13e929daa7c8.zip
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.
-rw-r--r--screen-write.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/screen-write.c b/screen-write.c
index 9f37561f..5e73a4c1 100644
--- a/screen-write.c
+++ b/screen-write.c
@@ -1,4 +1,4 @@
-/* $Id: screen-write.c,v 1.58 2009-07-09 18:04:53 nicm Exp $ */
+/* $Id: screen-write.c,v 1.59 2009-07-09 18:08:13 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -232,8 +232,15 @@ screen_write_cursorup(struct screen_write_ctx *ctx, u_int ny)
if (ny == 0)
ny = 1;
- if (ny > s->cy)
- ny = s->cy;
+ if (s->cy < s->rupper) {
+ /* Above region. */
+ if (ny > s->cy)
+ ny = s->cy;
+ } else {
+ /* Below region. */
+ if (ny > s->cy - s->rupper)
+ ny = s->cy - s->rupper;
+ }
if (ny == 0)
return;
@@ -249,8 +256,15 @@ screen_write_cursordown(struct screen_write_ctx *ctx, u_int ny)
if (ny == 0)
ny = 1;
- if (ny > screen_size_y(s) - 1 - s->cy)
- ny = screen_size_y(s) - 1 - s->cy;
+ if (s->cy > s->rlower) {
+ /* Below region. */
+ if (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)
return;