about summary refs log tree commit diff stats
path: root/text.lua
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-07-12 16:43:23 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-07-12 16:51:18 -0700
commit188bbc73cc3c0baddcf48f2501b18248b7ed3fc1 (patch)
tree60fd7e7a527b340bf7a9b1881498ec5825ca13b4 /text.lua
parent800a5c064aeb6978928854e74a289702355f00f2 (diff)
downloadtext.love-188bbc73cc3c0baddcf48f2501b18248b7ed3fc1.tar.gz
add state arg to a few functions
  - Text.draw_highlight
  - Text.clip_selection
  - Text.selection
  - Text.cut_selection
  - Text.delete_selection
  - Text.delete_selection_without_undo
  - Text.mouse_pos
  - Text.to_pos
Diffstat (limited to 'text.lua')
-rw-r--r--text.lua8
1 files changed, 4 insertions, 4 deletions
diff --git a/text.lua b/text.lua
index 224b20b..edab9f5 100644
--- a/text.lua
+++ b/text.lua
@@ -47,8 +47,8 @@ function Text.draw(State, line, line_index, top, left, right)
     -- don't draw text above screen top
     if Text.le1(State.screen_top1, {line=line_index, pos=pos}) then
       if State.selection1.line then
-        local lo, hi = Text.clip_selection(line_index, pos, pos+frag_len, left, right)
-        Text.draw_highlight(line, x,y, pos, lo,hi)
+        local lo, hi = Text.clip_selection(State, line_index, pos, pos+frag_len, left, right)
+        Text.draw_highlight(State, line, x,y, pos, lo,hi)
       end
 --?       print('drawing '..frag)
       App.screen.draw(frag_text, x,y)
@@ -182,7 +182,7 @@ function Text.keychord_pressed(State, chord)
     record_undo_event({before=before, after=snapshot(State.cursor1.line)})
   elseif chord == 'backspace' then
     if State.selection1.line then
-      Text.delete_selection(State.margin_left, App.screen.width-State.margin_right)
+      Text.delete_selection(State, State.margin_left, App.screen.width-State.margin_right)
       schedule_save(State)
       return
     end
@@ -223,7 +223,7 @@ function Text.keychord_pressed(State, chord)
     record_undo_event({before=before, after=snapshot(State.cursor1.line)})
   elseif chord == 'delete' then
     if State.selection1.line then
-      Text.delete_selection(State.margin_left, App.screen.width-State.margin_right)
+      Text.delete_selection(State, State.margin_left, App.screen.width-State.margin_right)
       schedule_save(State)
       return
     end