aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2014-04-16 19:42:28 -0400
committerJesse Luehrs <doy@tozt.net>2014-04-16 19:42:28 -0400
commit04bb76dd50a8ae19f5ab333229edf1f3da92b933 (patch)
tree68e6a5e61beb4ace3e78ab404c83331315337e90
parentb42b118ec60f845c70baf721a26a7450656d0641 (diff)
downloadrunes-04bb76dd50a8ae19f5ab333229edf1f3da92b933.tar.gz
runes-04bb76dd50a8ae19f5ab333229edf1f3da92b933.zip
fix scrolling up
-rw-r--r--display.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/display.c b/display.c
index c3d60f6..ec59731 100644
--- a/display.c
+++ b/display.c
@@ -141,15 +141,19 @@ void runes_display_focus_out(RunesTerm *t)
void runes_display_move_to(RunesTerm *t, int row, int col)
{
- int scroll = row - t->scroll_bottom;
+ int height = t->scroll_bottom - t->scroll_top;
t->row = row + t->scroll_top;
t->col = col;
- if (scroll > 0) {
- runes_display_scroll_down(t, scroll);
+ if (row > height) {
+ runes_display_scroll_down(t, row - height);
t->row = t->scroll_bottom;
}
+ else if (row < 0) {
+ runes_display_scroll_up(t, -row);
+ t->row = t->scroll_top;
+ }
runes_display_position_cursor(t, t->cr);
}