aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2014-04-21 21:33:56 -0400
committerJesse Luehrs <doy@tozt.net>2014-04-21 21:33:56 -0400
commit5653cf7cb167eca68935d65e7693608c32e4000c (patch)
tree5da5ea764f8f09e9ecef7d744c90fc41079fe28f
parent2a63f74b48bcaf3ec8f4ab61273a57359202634c (diff)
downloadrunes-5653cf7cb167eca68935d65e7693608c32e4000c.tar.gz
runes-5653cf7cb167eca68935d65e7693608c32e4000c.zip
fix scrolling
the documentation is unclear here - it says that scroll regions define the bounds of all scroll and cursor motion operations, but apparently absolute cursor positioning is not considered a "cursor motion operation".
-rw-r--r--src/display.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/display.c b/src/display.c
index 40a87db..fa3ff17 100644
--- a/src/display.c
+++ b/src/display.c
@@ -104,17 +104,15 @@ void runes_display_focus_out(RunesTerm *t)
void runes_display_move_to(RunesTerm *t, int row, int col)
{
- int height = t->scroll_bottom - t->scroll_top;
-
- t->row = row + t->scroll_top;
+ t->row = row;
t->col = col;
- if (row > height) {
- runes_display_scroll_down(t, row - height);
+ if (row > t->scroll_bottom) {
+ runes_display_scroll_down(t, row - t->scroll_bottom);
t->row = t->scroll_bottom;
}
- else if (row < 0) {
- runes_display_scroll_up(t, -row);
+ else if (row < t->scroll_top) {
+ runes_display_scroll_up(t, t->scroll_top - row);
t->row = t->scroll_top;
}
@@ -442,7 +440,7 @@ void runes_display_set_scroll_region(
t->scroll_top = top;
t->scroll_bottom = bottom;
- runes_display_move_to(t, 0, 0);
+ runes_display_move_to(t, t->scroll_top, 0);
}
void runes_display_scroll_up(RunesTerm *t, int rows)