about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--main.lua2
-rw-r--r--manual_tests3
2 files changed, 4 insertions, 1 deletions
diff --git a/main.lua b/main.lua
index 96f56c7..d2b9425 100644
--- a/main.lua
+++ b/main.lua
@@ -270,7 +270,7 @@ function keychord_pressed(chord)
     local byte_offset = utf8.offset(Lines[Cursor_line].data, Cursor_pos)
     if byte_offset then
       table.insert(Lines, Cursor_line+1, {mode='text', data=string.sub(Lines[Cursor_line].data, byte_offset)})
-      Lines[Cursor_line].data = string.sub(Lines[Cursor_line].data, 1, byte_offset)
+      Lines[Cursor_line].data = string.sub(Lines[Cursor_line].data, 1, byte_offset-1)
       Cursor_line = Cursor_line+1
       Cursor_pos = 1
     end
diff --git a/manual_tests b/manual_tests
index 2790f39..b59fced 100644
--- a/manual_tests
+++ b/manual_tests
@@ -7,3 +7,6 @@ create drawing -> cursor bumps down below drawing
 backspace
   cursor_pos == 0, previous line is a drawing -> delete drawing, cursor still visible at start of line
   cursor_pos == 0, previous line is text -> join lines, cursor still at same character
+
+enter
+  cursor_pos == 0 -> insert empty line above current line