about summary refs log tree commit diff stats
path: root/edit.lua
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2024-10-29 20:56:36 -0700
committerKartik K. Agaram <vc@akkartik.com>2024-10-29 20:56:36 -0700
commit690ca0c34a1c05ee5c3d300559aed1244b5d9c8e (patch)
tree28fa095ad94935602876e87f4e053a91cd515511 /edit.lua
parent883ad16cd253d25963edc020ea1c1d827de74b79 (diff)
parent67e3cbe55a4ea3ed0d1048ba4d56108953da2300 (diff)
downloadview.love-690ca0c34a1c05ee5c3d300559aed1244b5d9c8e.tar.gz
Merge lines.love
Diffstat (limited to 'edit.lua')
-rw-r--r--edit.lua24
1 files changed, 1 insertions, 23 deletions
diff --git a/edit.lua b/edit.lua
index 12e2053..97860b7 100644
--- a/edit.lua
+++ b/edit.lua
@@ -97,28 +97,6 @@ function edit.invalid_cursor1(State)
   return cursor1.pos > #State.lines[cursor1.line].data + 1
 end
 
-function edit.put_cursor_on_next_line_wrapping_around_if_necessary(State)
-  local line = State.cursor1.line
-  local max = #State.lines
-  for _ = 1, max-1 do
-    line = (line+1) % max
-    if State.lines[line].mode == 'text' then
-      State.cursor1.line = line
-      State.cursor1.pos = 1
-      break
-    end
-  end
-end
-
-function edit.put_cursor_on_next_loc_wrapping_around_if_necessary(State)
-  local cursor_line = State.lines[State.cursor1.line].data
-  if State.cursor1.pos <= utf8.len(cursor_line) then
-    State.cursor1.pos = State.cursor1.pos + 1
-  else
-    edit.put_cursor_on_next_line_wrapping_around_if_necessary(State)
-  end
-end
-
 function edit.draw(State)
   love.graphics.setFont(State.font)
   App.color(Text_color)
@@ -306,7 +284,7 @@ function edit.keychord_press(State, chord, key)
       Text.search_next(State)
     elseif chord == 'down' then
       if #State.search_term > 0 then
-        edit.put_cursor_on_next_loc_wrapping_around_if_necessary(State)
+        Text.right(State)
         Text.search_next(State)
       end
     elseif chord == 'up' then