From 5a06c1286dabc2dc0fa82f41b9e79689e9a10105 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Thu, 23 Jun 2022 11:03:46 -0700 Subject: bugfix: recompute screen lines in backspace/delete Scenario: backspacing until a line takes up fewer screen lines, then pressing `down`. I've gone through and checked that fragments and screen_line_starting_pos are now cleared together everywhere. --- text.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/text.lua b/text.lua index b5e8392..0ed46f8 100644 --- a/text.lua +++ b/text.lua @@ -203,6 +203,7 @@ function Text.keychord_pressed(chord) Lines[Cursor1.line].data = string.sub(Lines[Cursor1.line].data, 1, byte_start-1) end Lines[Cursor1.line].fragments = nil + Lines[Cursor1.line].screen_line_starting_pos = nil Cursor1.pos = Cursor1.pos-1 end elseif Cursor1.line > 1 then @@ -214,6 +215,7 @@ function Text.keychord_pressed(chord) Cursor1.pos = utf8.len(Lines[Cursor1.line-1].data)+1 Lines[Cursor1.line-1].data = Lines[Cursor1.line-1].data..Lines[Cursor1.line].data Lines[Cursor1.line-1].fragments = nil + Lines[Cursor1.line-1].screen_line_starting_pos = nil table.remove(Lines, Cursor1.line) end Cursor1.line = Cursor1.line-1 @@ -249,6 +251,7 @@ function Text.keychord_pressed(chord) Lines[Cursor1.line].data = string.sub(Lines[Cursor1.line].data, 1, byte_start-1) end Lines[Cursor1.line].fragments = nil + Lines[Cursor1.line].screen_line_starting_pos = nil -- no change to Cursor1.pos end elseif Cursor1.line < #Lines then @@ -258,6 +261,7 @@ function Text.keychord_pressed(chord) -- join lines Lines[Cursor1.line].data = Lines[Cursor1.line].data..Lines[Cursor1.line+1].data Lines[Cursor1.line].fragments = nil + Lines[Cursor1.line].screen_line_starting_pos = nil table.remove(Lines, Cursor1.line+1) end end -- cgit 1.4.1-2-gfad0