mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-03 08:08:43 +00:00
LibGUI: Fix stuck on deleting word backward
<Ctrl-Backspace> will stuck when deleting at the end of line which contains only one single character. When finding the previous word break position starting at column 0 in TextDocument::first_word_break_before, the code enters an infinite while loop. The early return should simply fix this.
This commit is contained in:
parent
5c29b45d1d
commit
60805546bf
Notes:
sideshowbarker
2024-07-18 05:01:22 +09:00
Author: https://github.com/lixk28
Commit: 60805546bf
Pull-request: https://github.com/SerenityOS/serenity/pull/18605
Reviewed-by: https://github.com/AtkinsSJ ✅
1 changed files with 3 additions and 0 deletions
|
@ -754,6 +754,9 @@ TextPosition TextDocument::first_word_break_before(TextPosition const& position,
|
|||
|
||||
target.set_column(target.column() - modifier);
|
||||
|
||||
if (target.column() == 0)
|
||||
return target;
|
||||
|
||||
while (target.column() < line.length()) {
|
||||
if (auto index = Unicode::previous_word_segmentation_boundary(line.view(), target.column()); index.has_value()) {
|
||||
auto view_between_target_and_index = line.view().substring_view(*index, target.column() - *index);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue