mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-15 16:48:24 +03:00
TextEditor: Replace text in find textbox with selection
This patch makes it so that if the find/replace widget is opened while some text is selected, the find textbox's content is overrided with the selected text.
This commit is contained in:
parent
ecf58ddd4f
commit
49e8d34f0e
Notes:
sideshowbarker
2024-07-19 10:09:48 +09:00
Author: https://github.com/0xtechnobabble Commit: https://github.com/SerenityOS/serenity/commit/49e8d34f0e6 Pull-request: https://github.com/SerenityOS/serenity/pull/1054
@ -222,6 +222,11 @@ TextEditorWidget::TextEditorWidget()
|
||||
m_find_widget->set_visible(true);
|
||||
m_replace_widget->set_visible(true);
|
||||
m_find_textbox->set_focus(true);
|
||||
|
||||
if (m_editor->has_selection()) {
|
||||
auto selected_text = m_editor->document().text_in_range(m_editor->normalized_selection());
|
||||
m_find_textbox->set_text(selected_text);
|
||||
}
|
||||
m_find_textbox->select_all();
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user