diff options
author | Juan Manuel Tomás <jtomas1815@gmail.com> | 2020-04-29 13:34:01 -0300 |
---|---|---|
committer | Juan Manuel Tomás <jtomas1815@gmail.com> | 2020-04-29 13:34:01 -0300 |
commit | 418bc15176439c9315d4b789b24097e588f0e024 (patch) | |
tree | 8eeabbcd9f3d52b0bc37cbff16989c829cdee2aa /jet.c | |
parent | 839ff03b98de80ba367872f5f6d8cd28e706152b (diff) | |
download | jet-418bc15176439c9315d4b789b24097e588f0e024.tar.gz jet-418bc15176439c9315d4b789b24097e588f0e024.zip |
Make sure cursor is always on screen
Diffstat (limited to 'jet.c')
-rw-r--r-- | jet.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -62,9 +62,15 @@ int main(int argc, char *argv[]) { next_line(&cursor, window_width); break; case KEY_LEFT: + if (same_point(&cursor, &window_start)) { + prev_line(&window_start, window_width); + } move_point_backward(&cursor); break; case KEY_RIGHT: + if (same_point(&cursor, &window_end)) { + next_line(&window_start, window_width); + } move_point_forward(&cursor); break; case KEY_BACKSPACE: |