about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-05-17 21:55:19 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-05-17 21:55:19 -0700
commite1bc81408fc5097d5f0466e350a938147756921b (patch)
tree98369519b37e64758a2ae7bcbdcea4eb7e22a4d5
parent8d2f81948a995d642f4f4235226013276823b03e (diff)
downloadlines.love-e1bc81408fc5097d5f0466e350a938147756921b.tar.gz
move
-rw-r--r--main.lua26
1 files changed, 13 insertions, 13 deletions
diff --git a/main.lua b/main.lua
index 16d743a..a8bd866 100644
--- a/main.lua
+++ b/main.lua
@@ -270,6 +270,19 @@ function keychord_pressed(chord)
     table.insert(Lines, Cursor_line+1, {mode='text', data=''})
     Cursor_line = Cursor_line+1
     Cursor_pos = 1
+  elseif chord == 'left' then
+    if Cursor_pos > 1 then
+      Cursor_pos = Cursor_pos-1
+    end
+  elseif chord == 'right' then
+    if Cursor_pos <= #Lines[Cursor_line].data then
+      Cursor_pos = Cursor_pos+1
+    end
+  elseif chord == 'home' then
+    Cursor_pos = 1
+  elseif chord == 'end' then
+    Cursor_pos = #Lines[Cursor_line].data+1
+  -- transitioning between drawings and text
   elseif chord == 'backspace' then
     if Cursor_pos > 1 then
       local byte_start = utf8.offset(Lines[Cursor_line].data, Cursor_pos-1)
@@ -293,18 +306,6 @@ function keychord_pressed(chord)
       end
       Cursor_line = Cursor_line-1
     end
-  elseif chord == 'left' then
-    if Cursor_pos > 1 then
-      Cursor_pos = Cursor_pos-1
-    end
-  elseif chord == 'right' then
-    if Cursor_pos <= #Lines[Cursor_line].data then
-      Cursor_pos = Cursor_pos+1
-    end
-  elseif chord == 'home' then
-    Cursor_pos = 1
-  elseif chord == 'end' then
-    Cursor_pos = #Lines[Cursor_line].data+1
   elseif chord == 'delete' then
     if Cursor_pos <= #Lines[Cursor_line].data then
       local byte_start = utf8.offset(Lines[Cursor_line].data, Cursor_pos)
@@ -318,7 +319,6 @@ function keychord_pressed(chord)
         -- no change to Cursor_pos
       end
     end
-  -- transitioning between drawings and text
   elseif chord == 'up' then
     assert(Lines[Cursor_line].mode == 'text')
     local new_cursor_line = Cursor_line