# HG changeset patch # User Rik # Date 1360647544 28800 # Node ID 3a06aa956d96bbcb1f5f7c2b109fbc2a935a47c3 # Parent a1e67cf915ba4aaf5d5e24d193614b28fe7c3d77 Fix off-by-1 error in history list when running 'edit_history'. * libinterp/interpfcn/oct-hist.cc(do_edit_history): Don't replace 'edit_history' in history list as this has already been done in mk_tmp_hist_file(). diff -r a1e67cf915ba -r 3a06aa956d96 libinterp/interpfcn/oct-hist.cc --- a/libinterp/interpfcn/oct-hist.cc Mon Feb 11 13:28:04 2013 -0500 +++ b/libinterp/interpfcn/oct-hist.cc Mon Feb 11 21:39:04 2013 -0800 @@ -377,7 +377,9 @@ int hist_count = hlist.length () - 1; // switch to zero-based indexing // The current command line is already part of the history list by - // the time we get to this point. Delete it from the list. + // the time we get to this point. Delete the cmd from the list when + // executing 'edit_history' so that it doesn't show up in the history + // but the actual commands performed will. if (! insert_curr) command_history::remove (hist_count); @@ -521,13 +523,15 @@ continue; } - if (first) - { - first = 0; - edit_history_repl_hist (line); - } - else - edit_history_add_hist (line); + // Command 'edit history' has already been removed in + // mk_tmp_hist_file () + //if (first) + // { + // first = 0; + // edit_history_repl_hist (line); + // } + //else + edit_history_add_hist (line); delete [] line; }