changeset 8841:c74389115610

auto repeat for debugging commands
author John W. Eaton <jwe@octave.org>
date Mon, 23 Feb 2009 12:25:45 -0500
parents c690e3772583
children be7b30a24938
files src/ChangeLog src/input.cc
diffstat 2 files changed, 27 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Mon Feb 23 14:54:56 2009 +0100
+++ b/src/ChangeLog	Mon Feb 23 12:25:45 2009 -0500
@@ -1,3 +1,9 @@
+2009-02-23  John W. Eaton  <jwe@octave.org>
+
+	* input.cc (last_debugging_command): New static variable.
+	(octave_gets): Set it here.  Don't insert repeated debugging
+	commands in the history list.
+
 2009-02-23  Jaroslav Hajek  <highegg@gmail.com>
 
 	* DLD-FUNCTIONS/pinv.cc: Support diagonal and permutation matrices.
--- a/src/input.cc	Mon Feb 23 14:54:56 2009 +0100
+++ b/src/input.cc	Mon Feb 23 12:25:45 2009 -0500
@@ -149,6 +149,10 @@
 // TRUE if we are in debugging mode.
 bool Vdebugging = false;
 
+// If we are in debugging mode, this is the last command entered, so
+// that we can repeat the previous command if the user just types RET.
+static std::string last_debugging_command;
+
 // TRUE if we are running in the Emacs GUD mode.
 static bool Vgud_mode = false;
 
@@ -251,6 +255,8 @@
 
   std::string retval;
 
+  bool history_skip_auto_repeated_debugging_command = false;
+
   if ((interactive || forced_interactive)
       && (! (reading_fcn_file
 	     || reading_script_file
@@ -273,7 +279,19 @@
       // user input.
       if (! retval.empty ()
 	  && retval.find_first_not_of (" \t\n\r") != std::string::npos)
-	load_path::update ();
+	{
+	  load_path::update ();
+
+	  if (Vdebugging)
+	    last_debugging_command = retval;
+	  else
+	    last_debugging_command = std::string ();
+	}
+      else if (Vdebugging)
+	{
+	  retval = last_debugging_command;
+	  history_skip_auto_repeated_debugging_command = true;
+	}
     }
   else
     retval = gnu_readline ("");
@@ -282,7 +300,8 @@
 
   if (! current_input_line.empty ())
     {
-      if (! (input_from_startup_file || input_from_command_line_file))
+      if (! (input_from_startup_file || input_from_command_line_file
+	     || history_skip_auto_repeated_debugging_command))
 	command_history::add (current_input_line);
 
       if (! (reading_fcn_file || reading_script_file))