Mercurial > octave
changeset 26257:3f46b474d2bb
ensure right text position when clicking a search result link (bug #55228)
* documentation.cc (handle_search_result_clicked): go to text end and
search backward until last occurrence
author | Torsten <mttl@mailbox.org> |
---|---|
date | Mon, 17 Dec 2018 21:41:14 +0100 |
parents | d8ebeb1a82ea |
children | 6cd1752f21e9 |
files | libgui/src/documentation.cc |
diffstat | 1 files changed, 6 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/libgui/src/documentation.cc Mon Dec 17 11:36:59 2018 -0800 +++ b/libgui/src/documentation.cc Mon Dec 17 21:41:14 2018 +0100 @@ -491,7 +491,12 @@ m_find_line_edit->setText (m_query_string); m_find_line_edit->parentWidget ()->show (); - find_forward (); + // Go to to first occurrence of search text. Going to the end and then + // search backwards until the last occurrence ensures the search text + // is visible in the first line of the visible part of the text. + m_doc_browser->moveCursor (QTextCursor::End); + while (m_doc_browser->find (m_find_line_edit->text (), + QTextDocument::FindBackward)); } void documentation::select_all_occurrences (const QString& text)