diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2022-06-19 09:21:32 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2022-06-19 09:21:32 -0700 |
commit | 3ffc2ed8f32237969fb202f89200df01e7fbdbc8 (patch) | |
tree | af796fb781a10f436ac690fccef8f84fa72eae15 /main.lua | |
parent | 703ed905c13a837c683aed0bf09bb68b0d7c9430 (diff) | |
download | text.love-3ffc2ed8f32237969fb202f89200df01e7fbdbc8.tar.gz |
bugfix
To reproduce: click to position cursor at end of a line hit enter press any key before: newline got erased and key got added to previous line now: newline is preserved The new test checks a generalization of this.
Diffstat (limited to 'main.lua')
-rw-r--r-- | main.lua | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/main.lua b/main.lua index e5dde61..2ad8c76 100644 --- a/main.lua +++ b/main.lua @@ -347,6 +347,7 @@ function App.mousepressed(x,y, mouse_button) Old_selection1 = Selection1 Mousepress_shift = App.shift_down() Selection1 = {line=line_index, pos=Text.to_pos_on_line(line, x, y)} +--? print('selection') end elseif line.mode == 'drawing' then if Drawing.in_drawing(line, x, y) then @@ -372,6 +373,7 @@ function App.mousereleased(x,y, button) for line_index,line in ipairs(Lines) do if line.mode == 'text' then if Text.in_line(line_index,line, x,y) then +--? print('reset selection') Cursor1 = {line=line_index, pos=Text.to_pos_on_line(line, x, y)} --? print(Cursor1.line, Cursor1.pos) if Mousepress_shift then @@ -405,6 +407,9 @@ function App.textinput(t) Text.textinput(t) end schedule_save() + if not App.shift_down() then + Selection1 = {} + end end function App.keychord_pressed(chord) @@ -547,6 +552,9 @@ function App.keychord_pressed(chord) for _,line in ipairs(Lines) do line.y = nil end -- just in case we scroll Text.keychord_pressed(chord) end + if not App.shift_down() then + Selection1 = {} + end end function App.keyreleased(key, scancode) |