Add vi-like 'A' command.
This commit is contained in:
parent
ae6c183475
commit
92ebfee050
Notes:
sideshowbarker
2024-07-19 16:08:29 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/92ebfee050d
2 changed files with 8 additions and 0 deletions
|
@ -150,6 +150,7 @@ int Editor::exec()
|
|||
case 'k': move_up(); break;
|
||||
case 'l': move_right(); break;
|
||||
case 'i': set_mode(EditingDocument); break;
|
||||
case 'A': move_to_end_of_line(); set_mode(EditingDocument); break;
|
||||
case 'a': move_right(); set_mode(EditingDocument); break;
|
||||
case 'q': m_should_quit = true; break;
|
||||
case '\\': set_mode(EditingCommand); break;
|
||||
|
@ -226,6 +227,12 @@ void Editor::move_right()
|
|||
update_scroll_position_if_needed();
|
||||
}
|
||||
|
||||
void Editor::move_to_end_of_line()
|
||||
{
|
||||
m_cursor.move_to(m_cursor.line(), m_document->line(m_cursor.line()).length());
|
||||
update_scroll_position_if_needed();
|
||||
}
|
||||
|
||||
size_t Editor::max_line() const
|
||||
{
|
||||
return m_document->line_count() - 1;
|
||||
|
|
|
@ -42,6 +42,7 @@ private:
|
|||
void move_down();
|
||||
void move_up();
|
||||
void move_right();
|
||||
void move_to_end_of_line();
|
||||
|
||||
size_t max_line() const;
|
||||
size_t max_column() const;
|
||||
|
|
Loading…
Add table
Reference in a new issue