mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 12:19:54 +00:00
LibUnicode+LibWeb: Move should_continue_beyond_word helper in Segmenter
This commit is contained in:
parent
fb23fd328b
commit
46db0febf7
Notes:
github-actions[bot]
2024-10-31 19:05:03 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: 46db0febf7
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2091
Reviewed-by: https://github.com/trflynn89 ✅
4 changed files with 16 additions and 24 deletions
|
@ -166,16 +166,6 @@ void EditingHostManager::decrement_cursor_position_offset(CollapseSelection coll
|
|||
}
|
||||
}
|
||||
|
||||
static bool should_continue_beyond_word(Utf8View const& word)
|
||||
{
|
||||
for (auto code_point : word) {
|
||||
if (!Unicode::code_point_has_punctuation_general_category(code_point) && !Unicode::code_point_has_separator_general_category(code_point))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void EditingHostManager::increment_cursor_position_to_next_word(CollapseSelection collapse)
|
||||
{
|
||||
auto selection = m_document->get_selection();
|
||||
|
@ -200,7 +190,7 @@ void EditingHostManager::increment_cursor_position_to_next_word(CollapseSelectio
|
|||
} else {
|
||||
MUST(selection->set_base_and_extent(*node, selection->anchor_offset(), *node, *offset));
|
||||
}
|
||||
if (should_continue_beyond_word(word))
|
||||
if (Unicode::Segmenter::should_continue_beyond_word(word))
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
|
@ -227,7 +217,7 @@ void EditingHostManager::decrement_cursor_position_to_previous_word(CollapseSele
|
|||
} else {
|
||||
MUST(selection->set_base_and_extent(*node, selection->anchor_offset(), *node, *offset));
|
||||
}
|
||||
if (should_continue_beyond_word(word))
|
||||
if (Unicode::Segmenter::should_continue_beyond_word(word))
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue