diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2022-06-02 23:48:35 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2022-06-02 23:48:35 -0700 |
commit | dcdcd07902035183bfa3b6d412e56a5f582a7cda (patch) | |
tree | 86c4b3233604c77083900c3236b9e41b75517e06 /main.lua | |
parent | 1fc4214029c166adeb8a478e814dd77043576f46 (diff) | |
download | text.love-dcdcd07902035183bfa3b6d412e56a5f582a7cda.tar.gz |
switch undo/redo to ctrl- hotkeys
Diffstat (limited to 'main.lua')
-rw-r--r-- | main.lua | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/main.lua b/main.lua index 2892baf..589de0a 100644 --- a/main.lua +++ b/main.lua @@ -276,6 +276,24 @@ function App.keychord_pressed(chord) love.graphics.setFont(love.graphics.newFont(Font_height)) Text.redraw_all() Line_height = 26 + elseif chord == 'C-z' then + local event = undo_event() + if event then + local src = event.before + Screen_top1 = deepcopy(src.screen_top) + Cursor1 = deepcopy(src.cursor) + Selection1 = deepcopy(src.selection) + patch(Lines, event.after, event.before) + end + elseif chord == 'C-y' then + local event = redo_event() + if event then + local src = event.after + Screen_top1 = deepcopy(src.screen_top) + Cursor1 = deepcopy(src.cursor) + Selection1 = deepcopy(src.selection) + patch(Lines, event.before, event.after) + end elseif love.mouse.isDown('1') or chord:sub(1,2) == 'C-' then Drawing.keychord_pressed(chord) elseif chord == 'escape' and love.mouse.isDown('1') then |