about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2024-10-29 20:57:46 -0700
committerKartik K. Agaram <vc@akkartik.com>2024-10-29 20:57:46 -0700
commit761b5fc65cf41ac3b865a81e9312f73c9e8352e4 (patch)
tree170bd0b1b57ee8151fafcb2f974dab1a7a14d916
parentac8981e7580e8ad02c1f8445fc00ab08ba75b648 (diff)
parent690ca0c34a1c05ee5c3d300559aed1244b5d9c8e (diff)
downloadview.love-main.tar.gz
Merge text.love HEAD main
-rw-r--r--edit.lua24
-rw-r--r--source_edit.lua24
2 files changed, 2 insertions, 46 deletions
diff --git a/edit.lua b/edit.lua
index 8e91a03..cc3437f 100644
--- a/edit.lua
+++ b/edit.lua
@@ -92,28 +92,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)
@@ -282,7 +260,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
diff --git a/source_edit.lua b/source_edit.lua
index 7599a4a..a8dd682 100644
--- a/source_edit.lua
+++ b/source_edit.lua
@@ -153,28 +153,6 @@ function edit.put_cursor_on_next_text_line(State)
   end
 end
 
-function edit.put_cursor_on_next_text_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_text_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_text_line_wrapping_around_if_necessary(State)
-  end
-end
-
 function edit.draw(State, hide_cursor, show_line_numbers)
   State.button_handlers = {}
   love.graphics.setFont(State.font)
@@ -433,7 +411,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_text_loc_wrapping_around_if_necessary(State)
+        Text.right(State)
         Text.search_next(State)
       end
     elseif chord == 'up' then