1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 06:58:11 +00:00

Vim: Add change word and delete word functionality

Add the functionality of key sequences 'cw', 'ce', 'cb', 'dw', 'de' and 'db'.
This commit is contained in:
Zac 2021-01-27 21:57:39 +10:00 committed by Andreas Kling
parent e2d7945e0c
commit aaf691c4ef
5 changed files with 129 additions and 28 deletions

View file

@ -1130,6 +1130,15 @@ void TextEditor::delete_selection()
update();
}
void TextEditor::delete_text_range(TextRange range)
{
auto normalized_range = range.normalized();
execute<RemoveTextCommand>(document().text_in_range(normalized_range), normalized_range);
did_change();
set_cursor(normalized_range.start());
update();
}
void TextEditor::insert_at_cursor_or_replace_selection(const StringView& text)
{
ReflowDeferrer defer(*this);