Ladybird/Qt: Set find in page query to selected text on initial focus

This commit is contained in:
Tim Ledbetter 2024-06-04 06:07:25 +01:00 committed by Andreas Kling
parent 251bb4b860
commit 8c2f1fd68f
Notes: sideshowbarker 2024-07-17 01:46:00 +09:00

View File

@ -105,6 +105,9 @@ void FindInPageWidget::focusInEvent(QFocusEvent* event)
{ {
QWidget::focusInEvent(event); QWidget::focusInEvent(event);
m_find_text->setFocus(); m_find_text->setFocus();
auto selected_text = m_content_view->selected_text();
if (!selected_text.is_empty())
m_find_text->setText(qstring_from_ak_string(selected_text));
m_find_text->selectAll(); m_find_text->selectAll();
} }