about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-06-23 11:40:00 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-06-23 11:40:00 -0700
commitcb99ac300c851024c602921f3bb819c14e32aa83 (patch)
treeca1fbd4508a7ca9731f15d52fb6dea6eba752877
parent009c7abb609931449457ea1250f7acccb66a217a (diff)
downloadlines.love-cb99ac300c851024c602921f3bb819c14e32aa83.tar.gz
fix a failing test
I deployed this without even running it once :/ Production was broken
for 9 minutes until I rolled back.
-rw-r--r--text.lua6
1 files changed, 2 insertions, 4 deletions
diff --git a/text.lua b/text.lua
index 23e6e05..f37faae 100644
--- a/text.lua
+++ b/text.lua
@@ -201,7 +201,6 @@ function Text.keychord_pressed(chord)
         else
           Lines[Cursor1.line].data = string.sub(Lines[Cursor1.line].data, 1, byte_start-1)
         end
-        Text.clear_cache(Lines[Cursor1.line])
         Cursor1.pos = Cursor1.pos-1
       end
     elseif Cursor1.line > 1 then
@@ -212,7 +211,6 @@ function Text.keychord_pressed(chord)
         -- join lines
         Cursor1.pos = utf8.len(Lines[Cursor1.line-1].data)+1
         Lines[Cursor1.line-1].data = Lines[Cursor1.line-1].data..Lines[Cursor1.line].data
-        Text.clear_cache(Lines[Cursor1.line-1])
         table.remove(Lines, Cursor1.line)
       end
       Cursor1.line = Cursor1.line-1
@@ -223,6 +221,7 @@ function Text.keychord_pressed(chord)
       Screen_top1 = Text.to1(top2)
       Text.redraw_all()  -- if we're scrolling, reclaim all fragments to avoid memory leaks
     end
+    Text.clear_cache(Lines[Cursor1.line])
     assert(Text.le1(Screen_top1, Cursor1))
     schedule_save()
     record_undo_event({before=before, after=snapshot(Cursor1.line)})
@@ -247,7 +246,6 @@ function Text.keychord_pressed(chord)
         else
           Lines[Cursor1.line].data = string.sub(Lines[Cursor1.line].data, 1, byte_start-1)
         end
-        Text.clear_cache(Lines[Cursor1.line])
         -- no change to Cursor1.pos
       end
     elseif Cursor1.line < #Lines then
@@ -256,10 +254,10 @@ function Text.keychord_pressed(chord)
       else
         -- join lines
         Lines[Cursor1.line].data = Lines[Cursor1.line].data..Lines[Cursor1.line+1].data
-        Text.clear_cache(Lines[Cursor1.line])
         table.remove(Lines, Cursor1.line+1)
       end
     end
+    Text.clear_cache(Lines[Cursor1.line])
     schedule_save()
     record_undo_event({before=before, after=snapshot(Cursor1.line)})
   --== shortcuts that move the cursor