diff libgui/src/m-editor/octave-qscintilla.cc @ 27198:dffdabfd0213

fix cursor position for editor smart indent after keyword (bug #56533) * file-editor-tab.cc (notice_settings): initialize new class variable holding the width of the character used for indentation; (handle_cursor_moved): pass new class variable to smart_indent * file-editor-tab.h: new class variable for indentation character width * octave-qscintilla.cc (smart_indent): length of indentation character is a new parameter which is used for setting the cursor position at the end of the indentation of a new line * octave-qscintilla.cc (smart_indent): new parameter
author Torsten Lilge <ttl-octave@mailbox.org>
date Tue, 25 Jun 2019 22:10:14 +0200
parents fbe46901ae62
children 1ae91e5d70cc
line wrap: on
line diff
--- a/libgui/src/m-editor/octave-qscintilla.cc	Sat Jun 22 17:30:16 2019 -0500
+++ b/libgui/src/m-editor/octave-qscintilla.cc	Tue Jun 25 22:10:14 2019 +0200
@@ -499,8 +499,8 @@
   }
 
   // Do smart indendation after if, for, ...
-  void octave_qscintilla::smart_indent (bool do_smart_indent,
-                                        int do_auto_close, int line)
+  void octave_qscintilla::smart_indent (bool do_smart_indent, int do_auto_close,
+                                        int line, int ind_char_width)
   {
     QString prevline = text (line);
 
@@ -534,7 +534,7 @@
           {
             // Do smart indent in the current line (line+1)
             indent (line+1);
-            setCursorPosition (line+1, indentation (line) + indentationWidth ());
+            setCursorPosition (line+1, indentation (line+1) / ind_char_width);
           }
 
         if (do_auto_close