diff options
-rw-r--r-- | jet.c | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -60,6 +60,9 @@ int main(int argc, char *argv[]) { next_line(&window_start, window_width); } next_line(&cursor, window_width); + if (same_point(&cursor, &window_end)) { + move_point_backward(&cursor); + } break; case KEY_LEFT: if (same_point(&cursor, &window_start)) { @@ -72,6 +75,9 @@ int main(int argc, char *argv[]) { next_line(&window_start, window_width); } move_point_forward(&cursor); + if (same_point(&cursor, &window_end)) { + move_point_backward(&cursor); + } break; case KEY_BACKSPACE: if (same_point(&cursor, &window_start)) { @@ -84,6 +90,11 @@ int main(int argc, char *argv[]) { next_line(&window_start, window_width); } insert_at_point(&cursor, input); + move_point_backward(&cursor); + if (element(&cursor) == '\n') { + next_line(&window_start, window_width); + } + move_point_forward(&cursor); } } |