diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2023-12-09 10:00:27 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2023-12-09 10:00:27 -0800 |
commit | 3752993b3480f720eed162a4bf188e64e5a8b6c1 (patch) | |
tree | fd8d3ed9f3a889e73711de91114bdb038227adaf | |
parent | 56e904499b881f0ed19a1af2264205405c4317d4 (diff) | |
parent | 67e3a43b523d1398dbfc5b2f9c4ab129921ee4bb (diff) | |
download | view.love-3752993b3480f720eed162a4bf188e64e5a8b6c1.tar.gz |
Merge text.love
-rw-r--r-- | source_text.lua | 3 | ||||
-rw-r--r-- | text.lua | 3 |
2 files changed, 2 insertions, 4 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 b869d6b..6dfd81b 100644 --- a/text.lua +++ b/text.lua @@ -717,9 +717,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 |