about summary refs log tree commit diff stats
path: root/text.lua
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-05-30 15:40:36 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-05-30 15:40:36 -0700
commitb22bfe82dbd3ef91c47ff0e43a845f55916796c2 (patch)
treeed3b3db8a1ba2345d3f156109ba60f9fe29ecd4f /text.lua
parent3b4dacaee81ec55a1dccdb50584d45ca5bbe00ec (diff)
downloadtext.love-b22bfe82dbd3ef91c47ff0e43a845f55916796c2.tar.gz
support non-text lines in Text.to2
Originally I was only using it on cursor line, but there's no reason
that has to be true in general.
Diffstat (limited to 'text.lua')
-rw-r--r--text.lua4
1 files changed, 3 insertions, 1 deletions
diff --git a/text.lua b/text.lua
index c4b9163..fe95772 100644
--- a/text.lua
+++ b/text.lua
@@ -1737,7 +1737,9 @@ function Text.x(s, pos)
 end
 
 function Text.to2(pos1)
-  assert(Lines[pos1.line].mode == 'text')
+  if Lines[pos1.line].mode == 'drawing' then
+    return {line=pos1.line, screen_line=1, screen_pos=1}
+  end
   local result = {line=pos1.line, screen_line=1}
   if Lines[pos1.line].screen_line_starting_pos == nil then
     result.screen_pos = pos1.pos