aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1994-06-18 14:53:55 +0000
committerRichard M. Stallman1994-06-18 14:53:55 +0000
commit7a80a6f6590a366110d2033de440dcb44ae8656c (patch)
treef6e1db459886934c06ba5ec62acd6cb7a51759cd /src
parent6f10bc9dbc727adb469db7202b47548bd7980512 (diff)
downloademacs-7a80a6f6590a366110d2033de440dcb44ae8656c.tar.gz
emacs-7a80a6f6590a366110d2033de440dcb44ae8656c.zip
(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.
Diffstat (limited to 'src')
-rw-r--r--src/keyboard.c41
1 files changed, 33 insertions, 8 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index 04330a41eb9..20ea07a6d5a 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -489,6 +489,10 @@ static char echobuf[300];
489/* Where to append more text to echobuf if we want to. */ 489/* Where to append more text to echobuf if we want to. */
490static char *echoptr; 490static char *echoptr;
491 491
492/* If we have echoed a prompt string specified by the user,
493 this is its length. Otherwise this is -1. */
494static int echo_after_prompt;
495
492/* Nonzero means don't try to suspend even if the operating system seems 496/* Nonzero means don't try to suspend even if the operating system seems
493 to support it. */ 497 to support it. */
494static int cannot_suspend; 498static int cannot_suspend;
@@ -504,12 +508,15 @@ echo_prompt (str)
504 char *str; 508 char *str;
505{ 509{
506 int len = strlen (str); 510 int len = strlen (str);
511
507 if (len > sizeof echobuf - 4) 512 if (len > sizeof echobuf - 4)
508 len = sizeof echobuf - 4; 513 len = sizeof echobuf - 4;
509 bcopy (str, echobuf, len); 514 bcopy (str, echobuf, len);
510 echoptr = echobuf + len; 515 echoptr = echobuf + len;
511 *echoptr = '\0'; 516 *echoptr = '\0';
512 517
518 echo_after_prompt = len;
519
513 echo (); 520 echo ();
514} 521}
515 522
@@ -568,6 +575,9 @@ echo_dash ()
568{ 575{
569 if (!immediate_echo && echoptr == echobuf) 576 if (!immediate_echo && echoptr == echobuf)
570 return; 577 return;
578 /* Do nothing if we just printed a prompt. */
579 if (echo_after_prompt != echoptr - echobuf)
580 return;
571 /* Do nothing if not echoing at all. */ 581 /* Do nothing if not echoing at all. */
572 if (echoptr == 0) 582 if (echoptr == 0)
573 return; 583 return;
@@ -615,6 +625,7 @@ cancel_echoing ()
615{ 625{
616 immediate_echo = 0; 626 immediate_echo = 0;
617 echoptr = echobuf; 627 echoptr = echobuf;
628 echo_after_prompt = -1;
618} 629}
619 630
620/* Return the length of the current echo string. */ 631/* Return the length of the current echo string. */
@@ -4677,7 +4688,9 @@ read_key_sequence (keybuf, bufsize, prompt)
4677 goto replay_key; 4688 goto replay_key;
4678 } 4689 }
4679 } 4690 }
4680 else 4691 else if (CONSP (XCONS (key)->cdr)
4692 && CONSP (EVENT_START (key))
4693 && CONSP (XCONS (EVENT_START (key))->cdr))
4681 { 4694 {
4682 Lisp_Object posn; 4695 Lisp_Object posn;
4683 4696
@@ -4884,6 +4897,14 @@ read_key_sequence (keybuf, bufsize, prompt)
4884 fkey_next 4897 fkey_next
4885 = get_keyelt (access_keymap (fkey_next, key, 1, 0)); 4898 = get_keyelt (access_keymap (fkey_next, key, 1, 0));
4886 4899
4900#if 0 /* I didn't turn this on, because it might cause trouble
4901 for the mapping of return into C-m and tab into C-i. */
4902 /* Optionally don't map function keys into other things.
4903 This enables the user to redefine kp- keys easily. */
4904 if (SYMBOLP (key) && !NILP (Vinhibit_function_key_mapping))
4905 fkey_next = Qnil;
4906#endif
4907
4887 /* If the function key map gives a function, not an 4908 /* If the function key map gives a function, not an
4888 array, then call the function with no args and use 4909 array, then call the function with no args and use
4889 its value instead. */ 4910 its value instead. */
@@ -5532,10 +5553,13 @@ interrupt_signal ()
5532 int old_errno = errno; 5553 int old_errno = errno;
5533 5554
5534#ifdef USG 5555#ifdef USG
5535 /* USG systems forget handlers when they are used; 5556 if (!read_socket_hook && NILP (Vwindow_system))
5536 must reestablish each time */ 5557 {
5537 signal (SIGINT, interrupt_signal); 5558 /* USG systems forget handlers when they are used;
5538 signal (SIGQUIT, interrupt_signal); 5559 must reestablish each time */
5560 signal (SIGINT, interrupt_signal);
5561 signal (SIGQUIT, interrupt_signal);
5562 }
5539#endif /* USG */ 5563#endif /* USG */
5540 5564
5541 cancel_echoing (); 5565 cancel_echoing ();
@@ -5773,7 +5797,7 @@ init_keyboard ()
5773 if (initialized) 5797 if (initialized)
5774 Ffillarray (kbd_buffer_frame_or_window, Qnil); 5798 Ffillarray (kbd_buffer_frame_or_window, Qnil);
5775 5799
5776 if (!noninteractive) 5800 if (!noninteractive && !read_socket_hook && NILP (Vwindow_system))
5777 { 5801 {
5778 signal (SIGINT, interrupt_signal); 5802 signal (SIGINT, interrupt_signal);
5779#if defined (HAVE_TERMIO) || defined (HAVE_TERMIOS) 5803#if defined (HAVE_TERMIO) || defined (HAVE_TERMIOS)
@@ -5781,11 +5805,12 @@ init_keyboard ()
5781 SIGQUIT and we can't tell which one it will give us. */ 5805 SIGQUIT and we can't tell which one it will give us. */
5782 signal (SIGQUIT, interrupt_signal); 5806 signal (SIGQUIT, interrupt_signal);
5783#endif /* HAVE_TERMIO */ 5807#endif /* HAVE_TERMIO */
5808 }
5784/* Note SIGIO has been undef'd if FIONREAD is missing. */ 5809/* Note SIGIO has been undef'd if FIONREAD is missing. */
5785#ifdef SIGIO 5810#ifdef SIGIO
5786 signal (SIGIO, input_available_signal); 5811 if (!noninteractive)
5812 signal (SIGIO, input_available_signal);
5787#endif /* SIGIO */ 5813#endif /* SIGIO */
5788 }
5789 5814
5790/* Use interrupt input by default, if it works and noninterrupt input 5815/* Use interrupt input by default, if it works and noninterrupt input
5791 has deficiencies. */ 5816 has deficiencies. */