summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan Manuel Tomás <jtomas1815@gmail.com>2020-04-27 10:50:35 -0300
committerJuan Manuel Tomás <jtomas1815@gmail.com>2020-04-27 10:50:35 -0300
commit7ceba65d88079536d3b4b7132ad93fb3943c483d (patch)
tree21bf370383388b8615448f603c3c444d4146233b
parentcc670044329369c5f15580a901c3a6ac81899929 (diff)
downloadjet-7ceba65d88079536d3b4b7132ad93fb3943c483d.tar.gz
jet-7ceba65d88079536d3b4b7132ad93fb3943c483d.zip
Fix scrolling bug
-rw-r--r--jet.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/jet.c b/jet.c
index 586b791..00a8588 100644
--- a/jet.c
+++ b/jet.c
@@ -38,11 +38,11 @@ int main(int argc, char *argv[]) {
int number_of_lines = 0;
int x = -1, y = -1;
for (struct point i = {page, 0}; !at_eof(&i); move_point_forward(&i)) {
- if (element(&i) == '\n') number_of_lines++;
if (same_location(&i, &cursor)) {
getyx(stdscr, y, x);
}
if (number_of_lines >= current_line && number_of_lines < window_height + current_line) addch(element(&i));
+ if (element(&i) == '\n') number_of_lines++;
}
if (x > -1 && y > -1) {
move(y, x);