about summary refs log tree commit diff stats
path: root/source_text.lua
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2023-03-26 09:57:49 -0700
committerKartik K. Agaram <vc@akkartik.com>2023-03-26 09:57:49 -0700
commit0aa69d831d8116a3d35e963d021f8f95b16b30b4 (patch)
treef153924dfccda2f8db5b1b339f4ca0d457527ec1 /source_text.lua
parent46e568c4c566b6377b90daad211d16a59c540e4b (diff)
parenta3e5a1f22d7dce367e5d6a01420426b3fa4f35d5 (diff)
downloadtext.love-0aa69d831d8116a3d35e963d021f8f95b16b30b4.tar.gz
Merge lines.love
Diffstat (limited to 'source_text.lua')
-rw-r--r--source_text.lua1
1 files changed, 1 insertions, 0 deletions
diff --git a/source_text.lua b/source_text.lua
index fb4c389..4d13748 100644
--- a/source_text.lua
+++ b/source_text.lua
@@ -178,6 +178,7 @@ function Text.text_input(State, t)
 end
 
 function Text.insert_at_cursor(State, t)
+  assert(State.lines[State.cursor1.line].mode == 'text')
   local byte_offset = Text.offset(State.lines[State.cursor1.line].data, State.cursor1.pos)
   State.lines[State.cursor1.line].data = string.sub(State.lines[State.cursor1.line].data, 1, byte_offset-1)..t..string.sub(State.lines[State.cursor1.line].data, byte_offset)
   Text.clear_screen_line_cache(State, State.cursor1.line)