about summary refs log tree commit diff stats
path: root/text.lua
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-06-04 22:13:34 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-06-04 22:13:34 -0700
commit6267ddd2eb2f3e1def0555e4968681a1c094f0a0 (patch)
tree4d4fa50d431c4c89854729916f42589ba4c126df /text.lua
parent778bc78416a5fd20c50a6046c73a723fae0a906c (diff)
downloadtext.love-6267ddd2eb2f3e1def0555e4968681a1c094f0a0.tar.gz
bugfix: backspace from start of file
Diffstat (limited to 'text.lua')
-rw-r--r--text.lua5
1 files changed, 1 insertions, 4 deletions
diff --git a/text.lua b/text.lua
index 7302a0a..79d3675 100644
--- a/text.lua
+++ b/text.lua
@@ -182,10 +182,6 @@ function Text.keychord_pressed(chord)
     local before
     if Cursor1.pos > 1 then
       before = snapshot(Cursor1.line)
-    else
-      before = snapshot(Cursor1.line-1, Cursor1.line)
-    end
-    if Cursor1.pos > 1 then
       local byte_start = utf8.offset(Lines[Cursor1.line].data, Cursor1.pos-1)
       local byte_end = utf8.offset(Lines[Cursor1.line].data, Cursor1.pos)
       if byte_start then
@@ -198,6 +194,7 @@ function Text.keychord_pressed(chord)
         Cursor1.pos = Cursor1.pos-1
       end
     elseif Cursor1.line > 1 then
+      before = snapshot(Cursor1.line-1, Cursor1.line)
       if Lines[Cursor1.line-1].mode == 'drawing' then
         table.remove(Lines, Cursor1.line-1)
       else