about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--source_text.lua3
-rw-r--r--text.lua3
-rw-r--r--undo.lua1
3 files changed, 2 insertions, 5 deletions
diff --git a/source_text.lua b/source_text.lua
index c28e203..dac2820 100644
--- a/source_text.lua
+++ b/source_text.lua
@@ -974,9 +974,8 @@ function Text.offset(s, pos1)
   if pos1 == 1 then return 1 end
   local result = utf8.offset(s, pos1)
   if result == nil then
-    print(pos1, #s, s)
+    assert(false, ('Text.offset(%d) called on a string of length %d (byte size %d); this is likely a failure to handle utf8\n\n^%s$\n'):format(pos1, utf8.len(s), #s, s))
   end
-  assert(result, "Text.offset returned nil; this is likely a failure to handle utf8")
   return result
 end
 
diff --git a/text.lua b/text.lua
index 44846e3..5222e22 100644
--- a/text.lua
+++ b/text.lua
@@ -912,9 +912,8 @@ function Text.offset(s, pos1)
   if pos1 == 1 then return 1 end
   local result = utf8.offset(s, pos1)
   if result == nil then
-    print(pos1, #s, s)
+    assert(false, ('Text.offset(%d) called on a string of length %d (byte size %d); this is likely a failure to handle utf8\n\n^%s$\n'):format(pos1, utf8.len(s), #s, s))
   end
-  assert(result, "Text.offset returned nil; this is likely a failure to handle utf8")
   return result
 end
 
diff --git a/undo.lua b/undo.lua
index 1ed3ce7..e5dea93 100644
--- a/undo.lua
+++ b/undo.lua
@@ -65,7 +65,6 @@ function snapshot(State, s,e)
     elseif line.mode == 'drawing' then
       table.insert(event.lines, {mode='drawing', h=line.h, points=deepcopy(line.points), shapes=deepcopy(line.shapes), pending={}})
     else
-      print(line.mode)
       assert(false, ('unknown line mode %s'):format(line.mode))
     end
   end