about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-06-05 12:04:21 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-06-05 12:04:21 -0700
commitb1c7ebdca3ad96dc694125fade083c508b425889 (patch)
tree1a976c524db8543841930bbe7acb4567d77bc17f
parenta70d7ba8bc8a7aeff6bb0004f73eb5620dcf8dca (diff)
downloadview.love-b1c7ebdca3ad96dc694125fade083c508b425889.tar.gz
additional logging for an active bug
-rw-r--r--text.lua6
1 files changed, 5 insertions, 1 deletions
diff --git a/text.lua b/text.lua
index df491c7..27900c8 100644
--- a/text.lua
+++ b/text.lua
@@ -146,13 +146,17 @@ function Text.textinput(t)
 end
 
 function Text.insert_at_cursor(t)
+--?   print(Screen_top1.line, Screen_top1.pos, Cursor1.line, Cursor1.pos, Screen_bottom1.line, Screen_bottom1.pos)
   local byte_offset
   if Cursor1.pos > 1 then
     byte_offset = utf8.offset(Lines[Cursor1.line].data, Cursor1.pos)
   else
     byte_offset = 1
   end
---?   print(Screen_top1.line, Screen_top1.pos, Cursor1.line, Cursor1.pos, Screen_bottom1.line, Screen_bottom1.pos)
+  if byte_offset == nil then
+    print(Cursor1.line, Cursor1.pos, byte_offset, Lines[Cursor1.line].data)
+    assert(false)
+  end
   Lines[Cursor1.line].data = string.sub(Lines[Cursor1.line].data, 1, byte_offset-1)..t..string.sub(Lines[Cursor1.line].data, byte_offset)
   Lines[Cursor1.line].fragments = nil
   Lines[Cursor1.line].screen_line_starting_pos = nil