about summary refs log tree commit diff stats
path: root/edit.lua
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2023-11-18 12:27:46 -0800
committerKartik K. Agaram <vc@akkartik.com>2023-11-18 12:27:46 -0800
commita65d460c01371b00ddf390770f2712877e85a0a9 (patch)
treea271ef813fff5ede30c163eedb040144b3090de8 /edit.lua
parent5daddc8c7ac4fe55a0c49a7133abf435f3c9810b (diff)
parentde66b015bcfbf4a995b25cc74c5f95d2362760a8 (diff)
downloadview.love-a65d460c01371b00ddf390770f2712877e85a0a9.tar.gz
Merge text.love
Diffstat (limited to 'edit.lua')
-rw-r--r--edit.lua10
1 files changed, 2 insertions, 8 deletions
diff --git a/edit.lua b/edit.lua
index 262b63d..e606e98 100644
--- a/edit.lua
+++ b/edit.lua
@@ -95,14 +95,8 @@ end
 -- return y drawn until
 function edit.draw(State)
   App.color(Text_color)
-  if #State.lines ~= #State.line_cache then
-    print(('line_cache is out of date; %d when it should be %d'):format(#State.line_cache, #State.lines))
-    assert(false)
-  end
-  if not Text.le1(State.screen_top1, State.cursor1) then
-    print(State.screen_top1.line, State.screen_top1.pos, State.cursor1.line, State.cursor1.pos)
-    assert(false)
-  end
+  assert(#State.lines == #State.line_cache, ('line_cache is out of date; %d elements when it should be %d'):format(#State.line_cache, #State.lines))
+  assert(Text.le1(State.screen_top1, State.cursor1), ('screen_top (line=%d,pos=%d) is below cursor (line=%d,pos=%d)'):format(State.screen_top1.line, State.screen_top1.pos, State.cursor1.line, State.cursor1.pos))
   State.cursor_x = nil
   State.cursor_y = nil
   local y = State.top