diff options
author | Juan Manuel Tomás <jtomas1815@gmail.com> | 2020-04-29 13:41:20 -0300 |
---|---|---|
committer | Juan Manuel Tomás <jtomas1815@gmail.com> | 2020-04-29 13:41:20 -0300 |
commit | badecae294cdd8f9d67c1239a291d481dfb4e1a3 (patch) | |
tree | ee7d637e9507b3c1834d591de30b25909e985590 | |
parent | 418bc15176439c9315d4b789b24097e588f0e024 (diff) | |
download | jet-badecae294cdd8f9d67c1239a291d481dfb4e1a3.tar.gz jet-badecae294cdd8f9d67c1239a291d481dfb4e1a3.zip |
Fix cursor going oob on insert and delete
-rw-r--r-- | jet.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -74,9 +74,15 @@ int main(int argc, char *argv[]) { move_point_forward(&cursor); break; case KEY_BACKSPACE: + if (same_point(&cursor, &window_start)) { + prev_line(&window_start, window_width); + } delete_at_point(&cursor); break; default: + if (same_point(&cursor, &window_end)) { + next_line(&window_start, window_width); + } insert_at_point(&cursor, input); } } |