~akkartik/carousel.love

a920ae1fcc3ec981c8ba5176c531cc46eaf1c288 — Kartik K. Agaram a month ago 0eb3988 + 40da680
Merge template-live-editor-mobile
1 files changed, 1 insertions(+), 23 deletions(-)

M edit.lua
M edit.lua => edit.lua +1 -23
@@ 107,28 107,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, fg, hide_cursor, show_line_numbers)
  love.graphics.setFont(State.font)
  assert(#State.lines == #State.line_cache, ('line_cache is out of date; %d elements when it should be %d'):format(#State.line_cache, #State.lines))


@@ 317,7 295,7 @@ function edit.keychord_press(State, chord, key, readonly)
      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