changeset 24160:d0cee5e09879

fix auto close for case in editor (bug #52235) * octave_qscintilla (smart_indent): do smart indent but no autoclose for case and otherwise
author Torsten <mttl@mailbox.org>
date Fri, 20 Oct 2017 18:56:29 +0200
parents c4dac7a0da7e
children 48cf0f4cc7c8 37190507b5d7
files libgui/src/m-editor/octave-qscintilla.cc
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/m-editor/octave-qscintilla.cc	Thu Oct 19 08:14:52 2017 -0700
+++ b/libgui/src/m-editor/octave-qscintilla.cc	Fri Oct 20 18:56:29 2017 +0200
@@ -448,9 +448,9 @@
 {
   QString prevline = text (line);
 
-  QRegExp bkey = QRegExp ("^[\t ]*(if|for|while|switch|case|do|function"
-                          "|properties|events|classdef|unwind_protect"
-                          "|unwind_protect_cleanup|try)"
+  QRegExp bkey = QRegExp ("^[\t ]*(if|for|while|switch|case|otherwise"
+                          "|do|function|properties|events|classdef"
+                          "|unwind_protect|unwind_protect_cleanup|try)"
                           "[\r]?[\n\t #%]");
   // last word except for comments, assuming no ' or " in comment.
   // rx_end = QRegExp ("(\\w+)[ \t;\r\n]*([%#][^\"']*)?$");
@@ -480,7 +480,9 @@
           setCursorPosition (line+1, indentation (line) + indentationWidth ());
         }
 
-      if (do_auto_close && ! inline_end)
+      if (do_auto_close
+              && ! inline_end
+              && ! first_word.contains (QRegExp ("(case|otherwise)")))
         {
           // Do auto close
           auto_close (do_auto_close, line, prevline, first_word);