summaryrefslogtreecommitdiff
path: root/jet.c
diff options
context:
space:
mode:
Diffstat (limited to 'jet.c')
-rw-r--r--jet.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/jet.c b/jet.c
index f71ffae..9a42328 100644
--- a/jet.c
+++ b/jet.c
@@ -31,9 +31,12 @@ int main(int argc, char *argv[]) {
intrflush(stdscr, FALSE);
keypad(stdscr, TRUE);
+ int window_height = getmaxy(stdscr);
while (1) {
- for (int i = 0; i < file_size; i++) {
+ int current_line = 0;
+ for (int i = 0; i < file_size && current_line < window_height; i++) {
addch(buffer[i]);
+ if (buffer[i] == '\n') current_line++;
}
getch();
clear();