diff options
Diffstat (limited to 'main.lua')
-rw-r--r-- | main.lua | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/main.lua b/main.lua index d4fd32a..270e0b7 100644 --- a/main.lua +++ b/main.lua @@ -391,6 +391,7 @@ function App.mousereleased(x,y, button) end end +-- don't depend on state of Selection1; use keychord_pressed for that function App.textinput(t) for _,line in ipairs(Lines) do line.y = nil end -- just in case we scroll if Search_term then @@ -407,9 +408,6 @@ function App.textinput(t) Text.textinput(t) end schedule_save() - if not App.shift_down() then - Selection1 = {} - end end function App.keychord_pressed(chord) @@ -441,19 +439,15 @@ function App.keychord_pressed(chord) Search_term = '' Search_backup = {cursor={line=Cursor1.line, pos=Cursor1.pos}, screen_top={line=Screen_top1.line, pos=Screen_top1.pos}} assert(Search_text == nil) - Selection1 = {} elseif chord == 'C-=' then initialize_font_settings(Font_height+2) Text.redraw_all() - Selection1 = {} elseif chord == 'C--' then initialize_font_settings(Font_height-2) Text.redraw_all() - Selection1 = {} elseif chord == 'C-0' then initialize_font_settings(20) Text.redraw_all() - Selection1 = {} elseif chord == 'C-z' then for _,line in ipairs(Lines) do line.y = nil end -- just in case we scroll local event = undo_event() @@ -466,7 +460,6 @@ function App.keychord_pressed(chord) Text.redraw_all() -- if we're scrolling, reclaim all fragments to avoid memory leaks schedule_save() end - Selection1 = {} elseif chord == 'C-y' then for _,line in ipairs(Lines) do line.y = nil end -- just in case we scroll local event = redo_event() @@ -479,7 +472,6 @@ function App.keychord_pressed(chord) Text.redraw_all() -- if we're scrolling, reclaim all fragments to avoid memory leaks schedule_save() end - Selection1 = {} -- clipboard elseif chord == 'C-c' then for _,line in ipairs(Lines) do line.y = nil end -- just in case we scroll @@ -487,7 +479,6 @@ function App.keychord_pressed(chord) if s then App.setClipboardText(s) end - Selection1 = {} elseif chord == 'C-x' then for _,line in ipairs(Lines) do line.y = nil end -- just in case we scroll local s = Text.cut_selection() @@ -495,7 +486,6 @@ function App.keychord_pressed(chord) App.setClipboardText(s) end schedule_save() - Selection1 = {} elseif chord == 'C-v' then for _,line in ipairs(Lines) do line.y = nil end -- just in case we scroll -- We don't have a good sense of when to scroll, so we'll be conservative @@ -517,7 +507,6 @@ function App.keychord_pressed(chord) end schedule_save() record_undo_event({before=before, after=snapshot(before_line, Cursor1.line)}) - Selection1 = {} -- dispatch to drawing or text elseif App.mouse_down(1) or chord:sub(1,2) == 'C-' then -- DON'T reset line.y here @@ -562,6 +551,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) |