mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-20 17:58:18 +03:00
TextEditor: Clear the selection before deleting it
This patches fixes a crash of the Userland/TextEditor where it would crash when deleting a range spanning two lines. This was because the TextEditor would delete the range and modify the cursor position before clearing the selection. This would trigger a status bar update with the invalid selection.
This commit is contained in:
parent
97d0028098
commit
bd68ca362b
Notes:
sideshowbarker
2024-07-18 18:45:09 +09:00
Author: https://github.com/Pangoraw Commit: https://github.com/SerenityOS/serenity/commit/bd68ca362bd Pull-request: https://github.com/SerenityOS/serenity/pull/6818
@ -1220,8 +1220,9 @@ String TextEditor::selected_text() const
|
||||
void TextEditor::delete_selection()
|
||||
{
|
||||
auto selection = normalized_selection();
|
||||
execute<RemoveTextCommand>(selected_text(), selection);
|
||||
auto selected = selected_text();
|
||||
m_selection.clear();
|
||||
execute<RemoveTextCommand>(selected, selection);
|
||||
did_update_selection();
|
||||
did_change();
|
||||
set_cursor(selection.start());
|
||||
|
Loading…
Reference in New Issue
Block a user