Skip to content

Instantly share code, notes, and snippets.

View kattrali's full-sized avatar

Delisa kattrali

View GitHub Profile
class MoveNextLineCommand < DocumentCommand
def execute
doc = tab.edit_view.document
line_ix = doc.line_at_offset(doc.cursor_offset)
if line_ix == doc.line_count - 1
doc.cursor_offset = doc.length
else
doc.cursor_offset = doc.offset_at_line(line_ix + 1) - doc.delim.length
end
doc.ensure_visible(doc.cursor_offset)