Mercurial > octave
diff libinterp/corefcn/input.cc @ 28972:a00eca5d6cbe stable
allow auto repeat of debug commands to be disabled
* input.h, input.cc (input_system::m_auto_repeat_debug_command):
New member variable.
(input_system::auto_repeat_debug_command): New functions.
(Fauto_repeat_debug_command): New function.
* debug.txi: Document new function.
* NEWS: Mention new function.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 21 Oct 2020 14:45:40 -0400 |
parents | f0a3f4527ba6 |
children | fdb7c296505a 3180f830d396 |
line wrap: on
line diff
--- a/libinterp/corefcn/input.cc Tue Oct 20 13:27:38 2020 -0400 +++ b/libinterp/corefcn/input.cc Wed Oct 21 14:45:40 2020 -0400 @@ -410,10 +410,10 @@ input_system::input_system (interpreter& interp) : m_interpreter (interp), m_PS1 (R"(octave:\#> )"), m_PS2 ("> "), m_completion_append_char (' '), m_gud_mode (false), - m_mfile_encoding ("system"), m_last_debugging_command ("\n"), - m_input_event_hook_functions (), m_initialized (false) - { - } + m_mfile_encoding ("system"), m_auto_repeat_debug_command (true), + m_last_debugging_command ("\n"), m_input_event_hook_functions (), + m_initialized (false) + { } void input_system::initialize (bool line_editing) { @@ -541,6 +541,14 @@ return retval; } + octave_value + input_system::auto_repeat_debug_command (const octave_value_list& args, + int nargout) + { + return set_internal_variable (m_auto_repeat_debug_command, args, nargout, + "auto_repeat_debug_command"); + } + bool input_system::yes_or_no (const std::string& prompt) { std::string prompt_string = prompt + "(yes or no) "; @@ -751,7 +759,7 @@ else input_sys.last_debugging_command ("\n"); } - else if (tw.in_debug_repl ()) + else if (tw.in_debug_repl () && input_sys.auto_repeat_debug_command ()) { retval = input_sys.last_debugging_command (); history_skip_auto_repeated_debugging_command = true; @@ -1404,6 +1412,25 @@ return input_sys.mfile_encoding (args, nargout); } +DEFMETHOD (auto_repeat_debug_command, interp, args, nargout, + doc: /* -*- texinfo -*- +@deftypefn {} {@var{val} =} auto_repeat_debug_command () +@deftypefnx {} {@var{old_val} =} auto_repeat_debug_command (@var{new_val}) +@deftypefnx {} {} auto_repeat_debug_command (@var{new_val}, "local") +Query or set the internal variable that controls whether debugging +commands are automatically repeated when the input line is empty (typing +just @key{RET}). + +When called from inside a function with the @qcode{"local"} option, the +variable is changed locally for the function and any subroutines it calls. +The original variable value is restored when exiting the function. +@end deftypefn */) +{ + octave::input_system& input_sys = interp.get_input_system (); + + return input_sys.auto_repeat_debug_command (args, nargout); +} + // Always define these functions. The macro is intended to allow the // declarations to be hidden, not so that Octave will not provide the // functions if they are requested.