Way to avoid auto-repeating last command by <return> in debug mode?

Hi everyone,

Is there a way to temporarily suppress auto-repeating the last command when hitting return in an empty input line in debug mode? The following (simplified) procedure is used for sourcing a file and getting back to the input prompt when executing selected code in the editor:

     std::string pending_input = command_editor::get_current_line ();
     interp.source_file (file);
     command_editor::replace_line ("");
     command_editor::set_initial_input (pending_input);
     command_editor::redisplay ();
     command_editor::interrupt_event_loop ();
     command_editor::accept_line ();

When in debug mode, this additionally repeats the last command. This could be, e.g., prevented by using

     command_editor::replace_line ("#");   // line is not empty anymore

But this inserts “#” into the output and adds it to the history.


I don’t see an option for disabling that feature, but it should not be too hard to add one.

I was also looking for a (possibly undocumented) command like \relax in LaTeX or nop in some assemblers that does nothing and is not added to the history but is not just an empty line. That would also solve the problem when use in replace_line.

Even if we had a no-op command that is never added to the command history, it would probably still be useful to have an option to disable the command repeat feature of the debug REPL. Would the attached change work?

[EDIT]: Oops, I forgot to initialize the new member variable. Should be set to TRUE by default.

auto-repeat-diffs.txt (3.2 KB)

Do we need this option on stable? It seems like a safe change to make there, so I don’t object to doing it.

Yes, stable would be very good in order to avoid unwanted commands being executed.
I will report back after building and testing.

OK, I pushed it on stable and merged with default.

John, thanks for the new feature. The “run selected code” issue could be fixed now.