Mercurial > octave
changeset 27529:886df2049d81
only increment command number when complete block of code is parsed
* input.cc (base_reader::octave_gets): Don't increment current command
number here.
* interpreter.cc (interpreter::main_loop): Increment current command
number here, after a complete code block has been parsed
successfully.
(interpreter::execute): Don't reset command number.
* cmd-edit.h (command_editor::command_editor): Set initial value of
m_command_number to 1, not 0.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 18 Oct 2019 11:57:40 -0400 |
parents | e51284fc0a51 |
children | 7a9d2b0e6da8 |
files | libinterp/corefcn/input.cc libinterp/corefcn/interpreter.cc liboctave/util/cmd-edit.h |
diffstat | 3 files changed, 4 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/corefcn/input.cc Fri Oct 18 11:06:11 2019 -0400 +++ b/libinterp/corefcn/input.cc Fri Oct 18 11:57:40 2019 -0400 @@ -737,11 +737,7 @@ if (! history_skip_auto_repeated_debugging_command) { if (command_history::add (retval)) - { - evmgr.append_history (retval); - if (! tw.in_debug_repl ()) - command_editor::increment_current_command_number (); - } + evmgr.append_history (retval); } octave_diary << retval;
--- a/libinterp/corefcn/interpreter.cc Fri Oct 18 11:06:11 2019 -0400 +++ b/libinterp/corefcn/interpreter.cc Fri Oct 18 11:57:40 2019 -0400 @@ -707,10 +707,6 @@ command_editor::blink_matching_paren (false); } - // Avoid counting commands executed from startup or script files. - - command_editor::reset_current_command_number (1); - return main_loop (); } catch (const exit_exception& ex) @@ -1055,6 +1051,8 @@ if (stmt_list) { + command_editor::increment_current_command_number (); + m_evaluator.eval (stmt_list, m_interactive); } else if (repl_parser.at_end_of_input ())
--- a/liboctave/util/cmd-edit.h Fri Oct 18 11:06:11 2019 -0400 +++ b/liboctave/util/cmd-edit.h Fri Oct 18 11:57:40 2019 -0400 @@ -41,7 +41,7 @@ protected: command_editor (void) - : m_command_number (0), m_rows (24), m_cols (80), m_interrupted (false), + : m_command_number (1), m_rows (24), m_cols (80), m_interrupted (false), m_interrupt_event_loop (false), m_initial_input () { }