# HG changeset patch # User John W. Eaton # Date 1571414260 14400 # Node ID 886df2049d813a2a442ada8c472d57085b26f1e5 # Parent e51284fc0a51546dea68a6195f7acd7e078eaefc 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. diff -r e51284fc0a51 -r 886df2049d81 libinterp/corefcn/input.cc --- 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; diff -r e51284fc0a51 -r 886df2049d81 libinterp/corefcn/interpreter.cc --- 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 ()) diff -r e51284fc0a51 -r 886df2049d81 liboctave/util/cmd-edit.h --- 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 () { }