tFix status line behavior during scroll - ve - a minimal text editor (work in p… | |
git clone git://src.adamsgaard.dk/ve | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit ee8ccbb69c46ce38a5b115821e1dc6816e1dd0dc | |
parent 65a91ff9999be9f55f6f57b1ca91afc65f8bdbf6 | |
Author: Anders Damsgaard <[email protected]> | |
Date: Tue, 6 Aug 2019 12:56:13 +0200 | |
Fix status line behavior during scroll | |
Diffstat: | |
M input.c | 2 +- | |
M output.c | 3 ++- | |
2 files changed, 3 insertions(+), 2 deletions(-) | |
--- | |
diff --git a/input.c b/input.c | |
t@@ -14,7 +14,7 @@ editor_move_cursor(char key) | |
E.cursor_x--; | |
break; | |
case 'j': | |
- if (E.cursor_y < E.num_rows - E.status_height) | |
+ if (E.cursor_y < E.num_rows - 1) | |
E.cursor_y++; | |
break; | |
case 'k': | |
diff --git a/output.c b/output.c | |
t@@ -68,13 +68,14 @@ draw_status(struct abuf *ab) | |
} | |
} | |
+/* set vertical offset between file and screen when hitting the boundaries */ | |
void | |
editor_scroll() | |
{ | |
if (E.cursor_y < E.row_offset) | |
E.row_offset = E.cursor_y; | |
else if (E.cursor_y >= E.row_offset + E.screen_rows - E.status_height) | |
- E.row_offset = E.cursor_y - E.screen_rows + 1; | |
+ E.row_offset = E.cursor_y - E.screen_rows + E.status_height + … | |
} | |
/* draw editor screen. |