diff options
-rw-r--r-- | main.lua | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/main.lua b/main.lua index d2b9425..6e20cc0 100644 --- a/main.lua +++ b/main.lua @@ -268,12 +268,10 @@ function keychord_pressed(chord) -- shortcuts for text if chord == 'return' then 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-1) - Cursor_line = Cursor_line+1 - Cursor_pos = 1 - end + 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-1) + Cursor_line = Cursor_line+1 + Cursor_pos = 1 elseif chord == 'left' then assert(Lines[Cursor_line].mode == 'text') if Cursor_pos > 1 then |