diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2022-06-20 11:25:00 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2022-06-20 11:31:14 -0700 |
commit | 3986e99fe0586e35a0c649114a07e6dd90f769fc (patch) | |
tree | 240a7e744e8566905d28dd93ad123f4e9db073d3 /text.lua | |
parent | 3be413602a59ed735a33712380cedbdb8f5603df (diff) | |
download | lines.love-3986e99fe0586e35a0c649114a07e6dd90f769fc.tar.gz |
no, that's not right
Bugfix: we want selections to persist even when we lift up the shift key. This requires hoisting some code inside every case inside the whole keypress hierarchy, to ensure we never clear selections before textinput events can handle them. Current cross-cutting concerns we're explicitly scattering code for. - autosave - undo - selection management
Diffstat (limited to 'text.lua')
-rw-r--r-- | text.lua | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/text.lua b/text.lua index f7f2e80..2888c1f 100644 --- a/text.lua +++ b/text.lua @@ -175,6 +175,7 @@ function Text.keychord_pressed(chord) end schedule_save() record_undo_event({before=before, after=snapshot(before_line, Cursor1.line)}) + Selection1 = {} elseif chord == 'tab' then local before = snapshot(Cursor1.line) --? print(Screen_top1.line, Screen_top1.pos, Cursor1.line, Cursor1.pos, Screen_bottom1.line, Screen_bottom1.pos) @@ -186,10 +187,12 @@ function Text.keychord_pressed(chord) end schedule_save() record_undo_event({before=before, after=snapshot(Cursor1.line)}) + Selection1 = {} elseif chord == 'backspace' then if Selection1.line then Text.delete_selection() schedule_save() + Selection1 = {} return end local before @@ -228,10 +231,12 @@ function Text.keychord_pressed(chord) assert(Text.le1(Screen_top1, Cursor1)) schedule_save() record_undo_event({before=before, after=snapshot(Cursor1.line)}) + Selection1 = {} elseif chord == 'delete' then if Selection1.line then Text.delete_selection() schedule_save() + Selection1 = {} return end local before @@ -264,6 +269,7 @@ function Text.keychord_pressed(chord) end schedule_save() record_undo_event({before=before, after=snapshot(Cursor1.line)}) + Selection1 = {} --== shortcuts that move the cursor elseif chord == 'left' then if Selection1.line then |