changeset 2299:f296bbc757a1

[project @ 1996-06-23 03:45:44 by jwe]
author jwe
date Sun, 23 Jun 1996 03:45:44 +0000
parents 8fa2c46fca3e
children 9484969866d2
files src/input.cc src/input.h src/toplev.cc
diffstat 3 files changed, 20 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/input.cc	Mon Jun 17 08:40:42 1996 +0000
+++ b/src/input.cc	Sun Jun 23 03:45:44 1996 +0000
@@ -125,6 +125,9 @@
 // The current line of input, from wherever.
 string current_input_line;
 
+// TRUE after a call to completion_matches().
+bool octave_completion_matches_called = false;
+
 // Return the octal number parsed from STRING, or -1 to indicate that
 // the string contained a bad number.
 
@@ -1174,7 +1177,12 @@
 }
 
 DEFUN (completion_matches, args, nargout,
-  "completion_matches (HINT): generate possible completions given HINT")
+  "completion_matches (HINT): generate possible completions given HINT\n\
+\n\
+This function is provided for the benefit of programs like Emacs which\n\
+might be controlling Octave and handling user input.  The current command\n\
+number is not incremented when this function is called.  This is a feature,\n\
+not a bug.")
 {
   octave_value retval;
 
@@ -1236,6 +1244,8 @@
 	      for (int i = 0; i < len; i++)
 		octave_stdout << list[i] << "\n";
 	    }
+
+	  octave_completion_matches_called = true;
 	}
     }
   else
--- a/src/input.h	Mon Jun 17 08:40:42 1996 +0000
+++ b/src/input.h	Sun Jun 23 03:45:44 1996 +0000
@@ -67,6 +67,9 @@
 // A line of input.
 extern string current_input_line;
 
+// TRUE after a call to completion_matches().
+extern bool octave_completion_matches_called;
+
 char *gnu_readline (const char *s, bool force_readline = false);
 
 extern string Vps4;
--- a/src/toplev.cc	Mon Jun 17 08:40:42 1996 +0000
+++ b/src/toplev.cc	Sun Jun 23 03:45:44 1996 +0000
@@ -235,8 +235,13 @@
       if (retval == 0 && global_command)
 	{
 	  global_command->eval (1);
+
 	  delete global_command;
-	  current_command_number++;
+
+	  if (octave_completion_matches_called)
+	    octave_completion_matches_called = false;	    
+	  else
+	    current_command_number++;
 	}
     }
   while (retval == 0);