about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2024-10-14 15:55:11 -0700
committerKartik K. Agaram <vc@akkartik.com>2024-10-14 15:55:11 -0700
commit549423b01891b2bebfc869802f71e01327b9553b (patch)
treea3283a3cb3cade635850138bcbdb872462e2c420
parent0e042c1a47b754d4bd444f64d436131254939d6e (diff)
parente0ccf1de675d8b84553a8692d4616020f420e93e (diff)
downloadtext.love-549423b01891b2bebfc869802f71e01327b9553b.tar.gz
Merge lines.love HEAD main
-rw-r--r--source_text.lua4
-rw-r--r--text.lua4
2 files changed, 4 insertions, 4 deletions
diff --git a/source_text.lua b/source_text.lua
index 9125cb0..284ed00 100644
--- a/source_text.lua
+++ b/source_text.lua
@@ -90,9 +90,9 @@ function Text.screen_line(line, line_cache, i)
   if i >= #line_cache.screen_line_starting_pos then
     return line.data:sub(offset)
   end
-  local endpos = line_cache.screen_line_starting_pos[i+1]-1
+  local endpos = line_cache.screen_line_starting_pos[i+1]
   local end_offset = Text.offset(line.data, endpos)
-  return line.data:sub(offset, end_offset)
+  return line.data:sub(offset, end_offset-1)
 end
 
 function Text.draw_cursor(State, x, y)
diff --git a/text.lua b/text.lua
index 82b4ab8..e3802c6 100644
--- a/text.lua
+++ b/text.lua
@@ -65,9 +65,9 @@ function Text.screen_line(line, line_cache, i)
   if i >= #line_cache.screen_line_starting_pos then
     return line.data:sub(offset)
   end
-  local endpos = line_cache.screen_line_starting_pos[i+1]-1
+  local endpos = line_cache.screen_line_starting_pos[i+1]
   local end_offset = Text.offset(line.data, endpos)
-  return line.data:sub(offset, end_offset)
+  return line.data:sub(offset, end_offset-1)
 end
 
 function Text.draw_cursor(State, x, y)