about summary refs log tree commit diff stats
path: root/edit.lua
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-11-19 00:11:39 -0800
committerKartik K. Agaram <vc@akkartik.com>2022-11-19 00:27:20 -0800
commit44aa8226c4330bf1cf859c36a48803b7d71aa114 (patch)
tree1a877d45427062e9f6ae7c6be2f2c36b2f88049d /edit.lua
parentd5c34ba043d6fb470b2b358881a71aec079dd823 (diff)
downloadtext.love-44aa8226c4330bf1cf859c36a48803b7d71aa114.tar.gz
ctrl+a: select entire buffer
Diffstat (limited to 'edit.lua')
-rw-r--r--edit.lua5
1 files changed, 4 insertions, 1 deletions
diff --git a/edit.lua b/edit.lua
index db276a7..562bb6e 100644
--- a/edit.lua
+++ b/edit.lua
@@ -301,7 +301,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
@@ -378,6 +378,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