diff options
author | 0xtechnobabble <0xtechnobabble@protonmail.com> | 2020-01-11 21:08:35 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2020-01-12 01:41:36 +0100 |
commit | 49e8d34f0e6b3b3b6b2af1ab41c52198c84e86f0 (patch) | |
tree | 0f2dd7da1f5860d108d3b8fc9342a031bcda6cbd /Applications/TextEditor | |
parent | ecf58ddd4f756258a537ee66b27428e3407b7d07 (diff) | |
download | serenity-49e8d34f0e6b3b3b6b2af1ab41c52198c84e86f0.zip |
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.
Diffstat (limited to 'Applications/TextEditor')
-rw-r--r-- | Applications/TextEditor/TextEditorWidget.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Applications/TextEditor/TextEditorWidget.cpp b/Applications/TextEditor/TextEditorWidget.cpp index b6fdabc7e2..96e4d14d9b 100644 --- a/Applications/TextEditor/TextEditorWidget.cpp +++ b/Applications/TextEditor/TextEditorWidget.cpp @@ -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(); }); |