mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 21:07:36 +00:00
LibGUI: Add Ctrl-W to insert mode
In Vim's insert mode, Ctrl-W deletes the word before the cursor, like Ctrl-Backspace. Unlike Ctrl-Backspace, if only whitespace exists between the end of the word and the cursor, the word will be deleted with the whitespace. To do so, this commit introduces two methods: delete_previous_word() for TextEditor and first_word_before() for TextDocument, where the former depends on the latter. delete_previous_word() is then called in VimEditingEngine.
This commit is contained in:
parent
8f01a8b741
commit
808e5e813f
5 changed files with 52 additions and 0 deletions
|
@ -106,6 +106,8 @@ public:
|
|||
TextPosition first_word_break_before(const TextPosition&, bool start_at_column_before) const;
|
||||
TextPosition first_word_break_after(const TextPosition&) const;
|
||||
|
||||
TextPosition first_word_before(const TextPosition&, bool start_at_column_before) const;
|
||||
|
||||
void add_to_undo_stack(NonnullOwnPtr<TextDocumentUndoCommand>);
|
||||
|
||||
bool can_undo() const { return m_undo_stack.can_undo(); }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue