changeset 33438:b2333101ca29

allow to run selected tests and demos by F9 (bug #65577) * octave-qscintilla.cc (contextmenu_run): remove %! from the beginning of a selected line except the keywords demo and test are following
author Torsten Lilge <ttl-octave@mailbox.org>
date Sun, 21 Apr 2024 17:39:29 +0200
parents 60772ed3e920
children f31a0d826776
files libgui/src/m-editor/octave-qscintilla.cc
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/m-editor/octave-qscintilla.cc	Wed Mar 20 07:35:25 2024 +0100
+++ b/libgui/src/m-editor/octave-qscintilla.cc	Sun Apr 21 17:39:29 2024 +0200
@@ -888,8 +888,13 @@
   for (int i = 0; i < lines.count (); i++)
     {
       QString line = lines.at (i);
+
       if (line.trimmed ().isEmpty ())
         continue;
+
+      if (! line.contains (QRegularExpression("^%!(demo|test)\\s*")))
+        line.replace (QRegularExpression("^%!\\s"), "");   // allow running tests & demos
+
       QString line_escaped = line;
       line_escaped.replace (QString ("'"), QString ("''"));
       QString line_history = line;