mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-30 12:49:19 +00:00
LibWeb: Use correct previous word location when moving selection offset
Previously, this incorrect offset could cause a crash when moving the selection to the previous word.
This commit is contained in:
parent
1eb581815a
commit
6ee91c4189
Notes:
github-actions[bot]
2025-07-03 09:30:01 +00:00
Author: https://github.com/tcl3
Commit: 6ee91c4189
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5246
Reviewed-by: https://github.com/AtkinsSJ ✅
2 changed files with 28 additions and 1 deletions
|
@ -629,7 +629,7 @@ void Selection::move_offset_to_previous_word(bool collapse_selection)
|
|||
while (true) {
|
||||
auto focus_offset = this->focus_offset();
|
||||
if (auto offset = text_node.word_segmenter().previous_boundary(focus_offset); offset.has_value()) {
|
||||
auto word = text_node.data().code_points().substring_view(focus_offset, focus_offset - *offset);
|
||||
auto word = text_node.data().code_points().unicode_substring_view(*offset, focus_offset - *offset);
|
||||
if (collapse_selection) {
|
||||
MUST(collapse(anchor_node, *offset));
|
||||
m_document->reset_cursor_blink_cycle();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue