mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-02 09:18:52 +00:00
LibWeb: Fix crash when skipping to previous word with ctrl+left arrow
Before this change, skipping a word to the left in a non empty text input element would crash when near the end of the text as the offset + length of the substring would exceed the length of the string.
This commit is contained in:
parent
4913dac745
commit
1870f1a0a8
Notes:
github-actions[bot]
2024-11-25 02:03:28 +00:00
Author: https://github.com/nbvdkamp
Commit: 1870f1a0a8
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2558
1 changed files with 1 additions and 1 deletions
|
@ -794,7 +794,7 @@ void FormAssociatedTextControlElement::decrement_cursor_position_to_previous_wor
|
|||
|
||||
while (true) {
|
||||
if (auto offset = text_node->word_segmenter().previous_boundary(m_selection_end); offset.has_value()) {
|
||||
auto word = text_node->data().code_points().substring_view(m_selection_end, m_selection_end - *offset);
|
||||
auto word = text_node->data().code_points().substring_view(*offset, m_selection_end - *offset);
|
||||
if (collapse == CollapseSelection::Yes) {
|
||||
collapse_selection_to_offset(*offset);
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue