diff options
author | Juan Manuel Tomás <jtomas1815@gmail.com> | 2020-04-29 16:44:11 -0300 |
---|---|---|
committer | Juan Manuel Tomás <jtomas1815@gmail.com> | 2020-04-29 16:44:11 -0300 |
commit | ca5948e8fb58197681b7007bae07c8e726a5f462 (patch) | |
tree | d2e982bb741e70fa22bb9d71344db376db1051ee /jet.c | |
parent | badecae294cdd8f9d67c1239a291d481dfb4e1a3 (diff) | |
download | jet-ca5948e8fb58197681b7007bae07c8e726a5f462.tar.gz jet-ca5948e8fb58197681b7007bae07c8e726a5f462.zip |
Fix scrolling when inserting at buffer end
Diffstat (limited to 'jet.c')
-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); } } |