# HG changeset patch # User Torsten Lilge # Date 1713727811 -7200 # Node ID f31a0d82677635d281bf6f81ee980ce3eee27101 # Parent b2333101ca29d83bedcdeee98e2d21e28a4ab26e improve running test and demos by F9 (bug #65577) * octave-qscintilla.cc (contextmenu_run): remove %! from the beginning of a selected line except only if a space is followng, exception: assert diff -r b2333101ca29 -r f31a0d826776 libgui/src/m-editor/octave-qscintilla.cc --- a/libgui/src/m-editor/octave-qscintilla.cc Sun Apr 21 17:39:29 2024 +0200 +++ b/libgui/src/m-editor/octave-qscintilla.cc Sun Apr 21 21:30:11 2024 +0200 @@ -892,8 +892,17 @@ if (line.trimmed ().isEmpty ()) continue; - if (! line.contains (QRegularExpression("^%!(demo|test)\\s*"))) - line.replace (QRegularExpression("^%!\\s"), ""); // allow running tests & demos + if (line.startsWith ("%!")) // Handle tests and demos + { + // Do not remove %! if keyword is directly following. + // Exception: assert + { + // assert might be used without leading space + line.replace (QRegularExpression("^%!assert(\\s*)([^\\s]+)"), "assert\\1\\2"); + // Remove "%! " + line.replace (QRegularExpression("^%!\\s+"), ""); + } + } QString line_escaped = line; line_escaped.replace (QString ("'"), QString ("''"));