summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan Manuel Tomás <jtomas1815@gmail.com>2020-04-29 13:41:20 -0300
committerJuan Manuel Tomás <jtomas1815@gmail.com>2020-04-29 13:41:20 -0300
commitbadecae294cdd8f9d67c1239a291d481dfb4e1a3 (patch)
treeee7d637e9507b3c1834d591de30b25909e985590
parent418bc15176439c9315d4b789b24097e588f0e024 (diff)
downloadjet-badecae294cdd8f9d67c1239a291d481dfb4e1a3.tar.gz
jet-badecae294cdd8f9d67c1239a291d481dfb4e1a3.zip
Fix cursor going oob on insert and delete
-rw-r--r--jet.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/jet.c b/jet.c
index 200b93d..131802c 100644
--- a/jet.c
+++ b/jet.c
@@ -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);
}
}