mirror of
https://github.com/RGBCube/serenity
synced 2025-05-29 06:55:07 +00:00
LibGUI: Move text search functions from GTextEditor to GTextDocument
Also add a find_all() that retuns a Vector<GTextRange> and simply does a find_next() loop, returning all the matching ranges.
This commit is contained in:
parent
b81f6f2c43
commit
b8bf998b61
5 changed files with 132 additions and 118 deletions
|
@ -50,7 +50,7 @@ TextEditorWidget::TextEditorWidget()
|
|||
dbg() << "find_next(\"\")";
|
||||
return;
|
||||
}
|
||||
auto found_range = m_editor->find_next(needle, m_editor->normalized_selection().end());
|
||||
auto found_range = m_editor->document().find_next(needle, m_editor->normalized_selection().end());
|
||||
dbg() << "find_next(\"" << needle << "\") returned " << found_range;
|
||||
if (found_range.is_valid()) {
|
||||
m_editor->set_selection(found_range);
|
||||
|
@ -73,7 +73,7 @@ TextEditorWidget::TextEditorWidget()
|
|||
if (!selection_start.is_valid())
|
||||
selection_start = m_editor->normalized_selection().end();
|
||||
|
||||
auto found_range = m_editor->find_prev(needle, selection_start);
|
||||
auto found_range = m_editor->document().find_previous(needle, selection_start);
|
||||
|
||||
dbg() << "find_prev(\"" << needle << "\") returned " << found_range;
|
||||
if (found_range.is_valid()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue