diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2022-06-05 09:50:19 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2022-06-05 09:51:54 -0700 |
commit | e7a985bd0a02a1b443cb89ca5ce09506f18a870f (patch) | |
tree | 98fd5c801057f123d420f8a5ef597dd3890d509e /text.lua | |
parent | de473046bc6ad8b33e57399e662b271cd2f8cc44 (diff) | |
download | lines.love-e7a985bd0a02a1b443cb89ca5ce09506f18a870f.tar.gz |
bugfix in previous commit
I almost pushed this to production. That would have been catastrophic; the very first keystroke anyone typed into the editor would have failed. And in the process, this fixes the next bug on my TODO list! Paste on first line wasn't working. Now it is.
Diffstat (limited to 'text.lua')
-rw-r--r-- | text.lua | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/text.lua b/text.lua index 7fa4d2e..88ee18d 100644 --- a/text.lua +++ b/text.lua @@ -152,6 +152,7 @@ function Text.insert_at_cursor(t) else byte_offset = 1 end +--? print(Screen_top1.line, Screen_top1.pos, Cursor1.line, Cursor1.pos, Screen_bottom1.line, Screen_bottom1.pos) 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 @@ -160,6 +161,7 @@ function Text.insert_at_cursor(t) if scroll_down then Text.populate_screen_line_starting_pos(Cursor1.line) Text.snap_cursor_to_bottom_of_screen() +--? print('=>', Screen_top1.line, Screen_top1.pos, Cursor1.line, Cursor1.pos, Screen_bottom1.line, Screen_bottom1.pos) end end @@ -624,6 +626,7 @@ end function Text.snap_cursor_to_bottom_of_screen() local top2 = Text.to2(Cursor1) + top2.screen_pos = 1 -- start of screen line --? print('cursor pos '..tostring(Cursor1.pos)..' is on the #'..tostring(top2.screen_line)..' screen line down') local y = App.screen.height - Line_height -- duplicate some logic from love.draw |