mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:47:44 +00:00
LibGUI: Fix crash on deleting word forward
<Ctrl-Del> will crash when deleting at the end of line where the next line contains only punctuation and seperator characters, because TextDocument::first_word_break_after will return a wrong index of the next word break (+1 bigger than the correct index), thus RemoveTextCommand will try to remove a out-of-bound text range causing a crash.
This commit is contained in:
parent
60805546bf
commit
4fb200a546
1 changed files with 1 additions and 1 deletions
|
@ -791,7 +791,7 @@ TextPosition TextDocument::first_word_break_after(TextPosition const& position)
|
|||
auto view_between_target_and_index = line.view().substring_view(target.column(), *index - target.column());
|
||||
|
||||
if (should_continue_beyond_word(view_between_target_and_index)) {
|
||||
target.set_column(*index + 1);
|
||||
target.set_column(min(*index + 1, line.length()));
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue