about summary refs log tree commit diff stats
path: root/source_edit.lua
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2024-07-08 00:26:54 -0700
committerKartik K. Agaram <vc@akkartik.com>2024-07-08 00:26:54 -0700
commit5a74b6938e5a37b8b2d1f8e49039cf1cbae46a50 (patch)
tree413320b8ba650344d5051989a3a8a7e89a0847f7 /source_edit.lua
parent0fcbe310a21dc581a29d22366e20629fc9e321ac (diff)
downloadview.love-5a74b6938e5a37b8b2d1f8e49039cf1cbae46a50.tar.gz
purge obsolete term 'fragment'
Diffstat (limited to 'source_edit.lua')
-rw-r--r--source_edit.lua11
1 files changed, 4 insertions, 7 deletions
diff --git a/source_edit.lua b/source_edit.lua
index 34e12c3..9b3b7ba 100644
--- a/source_edit.lua
+++ b/source_edit.lua
@@ -53,8 +53,7 @@ function edit.initialize_state(top, left, right, font, font_height, line_height)
 
     -- rendering wrapped text lines needs some additional short-lived data per line:
     --   startpos, the index of data the line starts rendering from, can only be >1 for topmost line on screen
-    --   fragments: snippets of the line guaranteed to not straddle screen lines
-    --   screen_line_starting_pos: optional array of grapheme indices if it wraps over more than one screen line
+    --   screen_line_starting_pos: optional array of codepoint indices if it wraps over more than one screen line
     line_cache = {},
 
     -- Given wrapping, any potential location for the text cursor can be described in two ways:
@@ -400,7 +399,7 @@ function edit.keychord_press(State, chord, key)
       State.cursor1 = State.search_backup.cursor
       State.screen_top1 = State.search_backup.screen_top
       State.search_backup = nil
-      Text.redraw_all(State)  -- if we're scrolling, reclaim all fragments to avoid memory leaks
+      Text.redraw_all(State)  -- if we're scrolling, reclaim all line caches to avoid memory leaks
     elseif chord == 'return' then
       State.search_term = nil
       State.search_backup = nil
@@ -445,8 +444,7 @@ function edit.keychord_press(State, chord, key)
       patch_placeholders(State.line_cache, event.after, event.before)
       -- invalidate various cached bits of lines
       State.lines.current_drawing = nil
-      -- if we're scrolling, reclaim all fragments to avoid memory leaks
-      Text.redraw_all(State)
+      Text.redraw_all(State)  -- if we're scrolling, reclaim all line caches to avoid memory leaks
       schedule_save(State)
     end
   elseif chord == 'C-y' then
@@ -459,8 +457,7 @@ function edit.keychord_press(State, chord, key)
       patch(State.lines, event.before, event.after)
       -- invalidate various cached bits of lines
       State.lines.current_drawing = nil
-      -- if we're scrolling, reclaim all fragments to avoid memory leaks
-      Text.redraw_all(State)
+      Text.redraw_all(State)  -- if we're scrolling, reclaim all line caches to avoid memory leaks
       schedule_save(State)
     end
   -- clipboard