changeset 16051:3a06aa956d96

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().
author Rik <rik@octave.org>
date Mon, 11 Feb 2013 21:39:04 -0800
parents a1e67cf915ba
children a59cb5c06d79
files libinterp/interpfcn/oct-hist.cc
diffstat 1 files changed, 12 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- 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;
     }