summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--jet.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/jet.c b/jet.c
index 131802c..3146221 100644
--- a/jet.c
+++ b/jet.c
@@ -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);
}
}