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:33:26 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-07-12 16:33:26 -0700
commitadeb5416c61c7a5face4f082fee32e70a0e69203 (patch)
tree763b9189f9143523b5d512fffa3a19bdfeea50ec /text.lua
parentb7000215d8921490cb08ed64439a02e9f69770b5 (diff)
downloadlines.love-adeb5416c61c7a5face4f082fee32e70a0e69203.tar.gz
add state arg to Text.textinput
Diffstat (limited to 'text.lua')
-rw-r--r--text.lua16
1 files changed, 8 insertions, 8 deletions
diff --git a/text.lua b/text.lua
index 33ea0f1..1296254 100644
--- a/text.lua
+++ b/text.lua
@@ -134,18 +134,18 @@ function Text.compute_fragments(line, left, right)
   end
 end
 
-function Text.textinput(t)
+function Text.textinput(State, t)
   if App.mouse_down(1) then return end
   if App.ctrl_down() or App.alt_down() or App.cmd_down() then return end
-  local before = snapshot(Editor_state.cursor1.line)
---?   print(Editor_state.screen_top1.line, Editor_state.screen_top1.pos, Editor_state.cursor1.line, Editor_state.cursor1.pos, Editor_state.screen_bottom1.line, Editor_state.screen_bottom1.pos)
+  local before = snapshot(State.cursor1.line)
+--?   print(State.screen_top1.line, State.screen_top1.pos, State.cursor1.line, State.cursor1.pos, State.screen_bottom1.line, State.screen_bottom1.pos)
   Text.insert_at_cursor(t)
-  if Editor_state.cursor_y >= App.screen.height - Editor_state.line_height then
-    Text.populate_screen_line_starting_pos(Editor_state.lines[Editor_state.cursor1.line], Editor_state.margin_left, App.screen.width-Editor_state.margin_right)
-    Text.snap_cursor_to_bottom_of_screen(Editor_state.margin_left, App.screen.width-Editor_state.margin_right)
---?     print('=>', Editor_state.screen_top1.line, Editor_state.screen_top1.pos, Editor_state.cursor1.line, Editor_state.cursor1.pos, Editor_state.screen_bottom1.line, Editor_state.screen_bottom1.pos)
+  if State.cursor_y >= App.screen.height - State.line_height then
+    Text.populate_screen_line_starting_pos(State.lines[State.cursor1.line], State.margin_left, App.screen.width-State.margin_right)
+    Text.snap_cursor_to_bottom_of_screen(State.margin_left, App.screen.width-State.margin_right)
+--?     print('=>', State.screen_top1.line, State.screen_top1.pos, State.cursor1.line, State.cursor1.pos, State.screen_bottom1.line, State.screen_bottom1.pos)
   end
-  record_undo_event({before=before, after=snapshot(Editor_state.cursor1.line)})
+  record_undo_event({before=before, after=snapshot(State.cursor1.line)})
 end
 
 function Text.insert_at_cursor(t)