diff libgui/src/m-editor/file-editor-tab.cc @ 28301:b8a38ed00bf4

maint: merge stable to default.
author Rik <rik@octave.org>
date Sat, 16 May 2020 13:36:48 -0700
parents 908bdd05398a 1127bcb30e61
children 668b38ab90f7
line wrap: on
line diff
--- a/libgui/src/m-editor/file-editor-tab.cc	Sat May 16 13:32:24 2020 -0700
+++ b/libgui/src/m-editor/file-editor-tab.cc	Sat May 16 13:36:48 2020 -0700
@@ -3188,8 +3188,9 @@
               {
                 // word is not empty, so find all occurrences of the word
 
-                // remember first visible line for restoring the view afterwards
+                // remember first visible line and x-offset for restoring the view afterwards
                 int first_line = m_edit_area->firstVisibleLine ();
+                int x_offset = m_edit_area->SendScintilla (QsciScintillaBase::SCI_GETXOFFSET);
 
                 // search for first occurrence of the detected word
                 bool find_result_available
@@ -3224,6 +3225,7 @@
                 // restore the visible area of the file, the cursor position,
                 // and the selection
                 m_edit_area->setFirstVisibleLine (first_line);
+                m_edit_area->SendScintilla (QsciScintillaBase::SCI_SETXOFFSET, x_offset);
                 m_edit_area->setCursorPosition (line, col);
                 m_edit_area->setSelection (line, col - wlen, line, col);
                 m_edit_area->set_word_selection (word);