diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2022-11-19 00:28:37 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2022-11-19 00:28:37 -0800 |
commit | 356fed8a24ce1bf3c51abd8013427670135620ee (patch) | |
tree | 3590b804caf714d4b8eb3ea4b56bd85a3d7a39f7 | |
parent | ec4cda13aa8a3f1dd9c544b87de0f7a4f0a57499 (diff) | |
parent | 44aa8226c4330bf1cf859c36a48803b7d71aa114 (diff) | |
download | view.love-356fed8a24ce1bf3c51abd8013427670135620ee.tar.gz |
Merge lines.love
-rw-r--r-- | README.md | 1 | ||||
-rw-r--r-- | edit.lua | 5 | ||||
-rw-r--r-- | source_edit.lua | 5 |
3 files changed, 9 insertions, 2 deletions
diff --git a/README.md b/README.md index 1abf90d..0f3d8a6 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,7 @@ While editing text: * `ctrl+z` to undo, `ctrl+y` to redo * `ctrl+=` to zoom in, `ctrl+-` to zoom out, `ctrl+0` to reset zoom * `alt+right`/`alt+left` to jump to the next/previous word, respectively +* mouse drag or `shift` + movement to select text, `ctrl+a` to select all * `ctrl+e` to modify the sources Exclusively tested so far with a US keyboard layout. If diff --git a/edit.lua b/edit.lua index f3a65ec..147cb09 100644 --- a/edit.lua +++ b/edit.lua @@ -196,7 +196,7 @@ function edit.keychord_pressed(State, chord, key) -- printable character created using shift key => delete selection -- (we're not creating any ctrl-shift- or alt-shift- combinations using regular/printable keys) (not App.shift_down() or utf8.len(key) == 1) and - chord ~= 'C-c' and chord ~= 'C-x' and chord ~= 'backspace' and backspace ~= 'delete' and not App.is_cursor_movement(chord) then + chord ~= 'C-a' and chord ~= 'C-c' and chord ~= 'C-x' and chord ~= 'backspace' and backspace ~= 'delete' and not App.is_cursor_movement(chord) then Text.delete_selection(State, State.left, State.right) end if State.search_term then @@ -269,6 +269,9 @@ function edit.keychord_pressed(State, chord, key) schedule_save(State) end -- clipboard + elseif chord == 'C-a' then + State.selection1 = {line=1, pos=1} + State.cursor1 = {line=#State.lines, pos=utf8.len(State.lines[#State.lines].data)+1} elseif chord == 'C-c' then local s = Text.selection(State) if s then diff --git a/source_edit.lua b/source_edit.lua index 1d82596..ab2fa33 100644 --- a/source_edit.lua +++ b/source_edit.lua @@ -311,7 +311,7 @@ function edit.keychord_pressed(State, chord, key) -- printable character created using shift key => delete selection -- (we're not creating any ctrl-shift- or alt-shift- combinations using regular/printable keys) (not App.shift_down() or utf8.len(key) == 1) and - chord ~= 'C-c' and chord ~= 'C-x' and chord ~= 'backspace' and backspace ~= 'delete' and not App.is_cursor_movement(chord) then + chord ~= 'C-a' and chord ~= 'C-c' and chord ~= 'C-x' and chord ~= 'backspace' and backspace ~= 'delete' and not App.is_cursor_movement(chord) then Text.delete_selection(State, State.left, State.right) end if State.search_term then @@ -417,6 +417,9 @@ function edit.keychord_pressed(State, chord, key) schedule_save(State) end -- clipboard + elseif chord == 'C-a' then + State.selection1 = {line=1, pos=1} + State.cursor1 = {line=#State.lines, pos=utf8.len(State.lines[#State.lines].data)+1, posB=nil} elseif chord == 'C-c' then local s = Text.selection(State) if s then |