~fancycade/tox.cr

2f9eddc748ad115573c8e900a018f6692dac6878 — fancycade 2 years ago 4f24c1e
Add bounds detection for cursor down

Fix issue with removing new lines after scrolling down
1 files changed, 10 insertions(+), 3 deletions(-)

M editor.cr
M editor.cr => editor.cr +10 -3
@@ 172,8 172,10 @@ class Editor
      if y < @w.height
        @cursor_y += 1
      elsif y == @w.height
        @start_row += 1
        @end_row += 1
        if @rows.size - @start_row > @w.height
          @start_row += 1
          @end_row += 1
        end
      end
      cursor_end_of_row()
    end


@@ 227,7 229,12 @@ class Editor
      row2.pop
      row2 = row2.concat(row)
      @rows.delete_at(y)
      cursor_up()
      if @start_row > 0
        @start_row -= 1
        cursor_end_of_row()
      else
        cursor_up()
      end
    end
  end