changeset 7957:a1404ed5d012

(echo_after_prompt): New variable. (echo_prompt, cancel_echoing): Set it. (echo_dash): Test it. (interrupt_signal, init_keyboard): Don't handle SIGINT and SIGQUIT if using window system directly. (read_key_sequence): Verify event has a POSN_BUFFER_POSN before trying to extract it.
author Richard M. Stallman <rms@gnu.org>
date Sat, 18 Jun 1994 14:53:55 +0000
parents eaca9ccb9f4a
children 1398a59935e7
files src/keyboard.c
diffstat 1 files changed, 33 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/keyboard.c	Sat Jun 18 14:49:34 1994 +0000
+++ b/src/keyboard.c	Sat Jun 18 14:53:55 1994 +0000
@@ -489,6 +489,10 @@
 /* Where to append more text to echobuf if we want to.  */
 static char *echoptr;
 
+/* If we have echoed a prompt string specified by the user,
+   this is its length.  Otherwise this is -1.  */
+static int echo_after_prompt;
+
 /* Nonzero means don't try to suspend even if the operating system seems
    to support it.  */
 static int cannot_suspend;
@@ -504,12 +508,15 @@
      char *str;
 {
   int len = strlen (str);
+
   if (len > sizeof echobuf - 4)
     len = sizeof echobuf - 4;
   bcopy (str, echobuf, len);
   echoptr = echobuf + len;
   *echoptr = '\0';
 
+  echo_after_prompt = len;
+
   echo ();
 }
 
@@ -568,6 +575,9 @@
 {
   if (!immediate_echo && echoptr == echobuf)
     return;
+  /* Do nothing if we just printed a prompt.  */
+  if (echo_after_prompt != echoptr - echobuf)
+    return;
   /* Do nothing if not echoing at all.  */
   if (echoptr == 0)
     return;
@@ -615,6 +625,7 @@
 {
   immediate_echo = 0;
   echoptr = echobuf;
+  echo_after_prompt = -1;
 }
 
 /* Return the length of the current echo string.  */
@@ -4677,7 +4688,9 @@
 		  goto replay_key;
 		}
 	    }
-	  else
+	  else if (CONSP (XCONS (key)->cdr)
+		   && CONSP (EVENT_START (key))
+		   && CONSP (XCONS (EVENT_START (key))->cdr))
 	    {
 	      Lisp_Object posn;
 
@@ -4884,6 +4897,14 @@
 	      fkey_next
 		= get_keyelt (access_keymap (fkey_next, key, 1, 0));
 
+#if 0 /* I didn't turn this on, because it might cause trouble
+	 for the mapping of return into C-m and tab into C-i.  */
+	      /* Optionally don't map function keys into other things.
+		 This enables the user to redefine kp- keys easily.  */
+	      if (SYMBOLP (key) && !NILP (Vinhibit_function_key_mapping))
+		fkey_next = Qnil;
+#endif
+
 	      /* If the function key map gives a function, not an
 		 array, then call the function with no args and use
 		 its value instead.  */
@@ -5532,10 +5553,13 @@
   int old_errno = errno;
 
 #ifdef USG
-  /* USG systems forget handlers when they are used;
-     must reestablish each time */
-  signal (SIGINT, interrupt_signal);
-  signal (SIGQUIT, interrupt_signal);
+  if (!read_socket_hook && NILP (Vwindow_system))
+    {
+      /* USG systems forget handlers when they are used;
+	 must reestablish each time */
+      signal (SIGINT, interrupt_signal);
+      signal (SIGQUIT, interrupt_signal);
+    }
 #endif /* USG */
 
   cancel_echoing ();
@@ -5773,7 +5797,7 @@
   if (initialized)
     Ffillarray (kbd_buffer_frame_or_window, Qnil);
 
-  if (!noninteractive)
+  if (!noninteractive && !read_socket_hook && NILP (Vwindow_system))
     {
       signal (SIGINT, interrupt_signal);
 #if defined (HAVE_TERMIO) || defined (HAVE_TERMIOS)
@@ -5781,11 +5805,12 @@
 	 SIGQUIT and we can't tell which one it will give us.  */
       signal (SIGQUIT, interrupt_signal);
 #endif /* HAVE_TERMIO */
+    }
 /* Note SIGIO has been undef'd if FIONREAD is missing.  */
 #ifdef SIGIO
-      signal (SIGIO, input_available_signal);
+  if (!noninteractive)
+    signal (SIGIO, input_available_signal);
 #endif /* SIGIO */
-    }
 
 /* Use interrupt input by default, if it works and noninterrupt input
    has deficiencies.  */