diff options
author | jmacd <jmacd@FreeBSD.org> | 1997-01-17 00:46:43 +0000 |
---|---|---|
committer | jmacd <jmacd@FreeBSD.org> | 1997-01-17 00:46:43 +0000 |
commit | 86219798bfc2e53fa78e40cd70f9ab9d1335427b (patch) | |
tree | ecefb344bab07ae8159309cf0a3eec82821b61c6 | |
parent | a3118e8c6826349b3fc54da3850d6dea994a3a35 (diff) | |
download | FreeBSD-src-86219798bfc2e53fa78e40cd70f9ab9d1335427b.zip FreeBSD-src-86219798bfc2e53fa78e40cd70f9ab9d1335427b.tar.gz |
Bring over Joerg's arrow-key, page-up, and page-down modifications.
-rw-r--r-- | contrib/texinfo/info/infomap.c | 66 | ||||
-rw-r--r-- | contrib/texinfo/info/session.c | 5 | ||||
-rw-r--r-- | contrib/texinfo/info/signals.c | 16 | ||||
-rw-r--r-- | contrib/texinfo/info/terminal.c | 27 |
4 files changed, 103 insertions, 11 deletions
diff --git a/contrib/texinfo/info/infomap.c b/contrib/texinfo/info/infomap.c index 3f24f1f..e67712f 100644 --- a/contrib/texinfo/info/infomap.c +++ b/contrib/texinfo/info/infomap.c @@ -25,6 +25,12 @@ #include "ctype.h" #include "infomap.h" #include "funs.h" +#include "info.h" + +static void add_function_key(char *, VFunction *, Keymap); + +extern char *term_ku, *term_kd, *term_kr, *term_kl; +extern char *term_kP, *term_kN, *term_kh, *term_kH; /* Return a new keymap which has all the uppercase letters mapped to run the function info_do_lowercase_version (). */ @@ -264,11 +270,59 @@ initialize_info_keymaps () map['o'].function = info_next_window; map['t'].function = info_tile_windows; map['w'].function = info_toggle_wrap; -} -/* Strings which represent the sequence of characters that the arrow keys - produce. If these keys begin with ESC, and the second character of the - sequence does not conflict with an existing binding in the Meta keymap, - then bind the keys to do what C-p, C-n, C-f, and C-b do. */ -extern char *term_ku, *term_kd, *term_kr, *term_kl; + /* Add functions for the arrow keys, PageUp, PageDown, Home, HomeDown */ + add_function_key(term_ku, info_prev_line, info_keymap); + add_function_key(term_kd, info_next_line, info_keymap); + add_function_key(term_kl, info_backward_char, info_keymap); + add_function_key(term_kr, info_forward_char, info_keymap); + add_function_key(term_kP, info_scroll_backward, info_keymap); + add_function_key(term_kN, info_scroll_forward, info_keymap); + add_function_key(term_kh, info_beginning_of_node, info_keymap); + add_function_key(term_kH, info_end_of_node, info_keymap); +} +static void add_function_key(char *esc_seq, VFunction *func, Keymap map) +{ + char *end_str, *p; + + if (!esc_seq) + return; /* don't add keys which don't exist */ + + end_str = esc_seq + strlen(esc_seq); + + for (p = esc_seq; p < end_str; p++) + { + if (isupper(*p)) + *p = tolower(*p); + switch (map[*p].type) + { + case ISKMAP: /* Go one level down. Also has the effect + that we're not overwriting a previous + binding if we're at the end of p */ + map = (Keymap)map[*p].function; + break; + case ISFUNC: /* two possibilities here: + 1. map[*p].function == NULL means we have + a virgin keymap to fill; + 2. else this entry is already taken */ + if (map[*p].function == NULL) + { + if (p == end_str - 1) + { + map[*p].function = func; + return; + } + map[*p].type = ISKMAP; + map[*p].function = (VFunction *)keymap_make_keymap(); + map = (Keymap)map[*p].function; + } else + return; + break; + default: /* can't happen */ + info_error("unknown keymap type (%d).", map[*p].type); + break; + } + } + return; +} diff --git a/contrib/texinfo/info/session.c b/contrib/texinfo/info/session.c index be3076c..494c4a1 100644 --- a/contrib/texinfo/info/session.c +++ b/contrib/texinfo/info/session.c @@ -27,6 +27,7 @@ #endif /* HAVE_SYS_FILE_H */ #include <sys/ioctl.h> #include <fcntl.h> +#include <stdlib.h> #if defined (HAVE_SYS_TIME_H) # include <sys/time.h> @@ -3847,8 +3848,8 @@ info_get_another_input_char () FD_ZERO (&readfds); FD_SET (fileno (info_input_stream), &readfds); - timer.tv_sec = 1; - timer.tv_usec = 750; + timer.tv_sec = 0; + timer.tv_usec = 0; ready = select (1, &readfds, (fd_set *)NULL, (fd_set *)NULL, &timer); #endif /* FD_SET */ } diff --git a/contrib/texinfo/info/signals.c b/contrib/texinfo/info/signals.c index a60777f..4f48e89 100644 --- a/contrib/texinfo/info/signals.c +++ b/contrib/texinfo/info/signals.c @@ -67,7 +67,7 @@ typedef SigHandlerType SigHandler (); static SigHandlerType info_signal_handler (); static SigHandler *old_TSTP, *old_TTOU, *old_TTIN; -static SigHandler *old_WINCH, *old_INT; +static SigHandler *old_WINCH, *old_INT, *old_CONT; void initialize_info_signal_handler () @@ -80,7 +80,10 @@ initialize_info_signal_handler () #if defined (SIGWINCH) old_WINCH = (SigHandler *) signal (SIGWINCH, info_signal_handler); -#endif +#if defined (SIGCONT) + old_CONT = (SigHandler *) signal (SIGCONT, info_signal_handler); +#endif /* SIGCONT */ +#endif /* SIGWINCH */ #if defined (SIGINT) old_INT = (SigHandler *) signal (SIGINT, info_signal_handler); @@ -146,6 +149,15 @@ info_signal_handler (sig) } break; +#if defined (SIGWINCH) && defined(SIGCONT) + case SIGCONT: + if(old_CONT) + (void)(old_CONT)(sig); + /* pretend a SIGWINCH in case the terminal window size has changed + while we've been asleep */ + /* FALLTROUGH */ +#endif /* defined (SIGWINCH) && defined(SIGCONT) */ + #if defined (SIGWINCH) case SIGWINCH: { diff --git a/contrib/texinfo/info/terminal.c b/contrib/texinfo/info/terminal.c index 0e9ca73..fcf5137 100644 --- a/contrib/texinfo/info/terminal.c +++ b/contrib/texinfo/info/terminal.c @@ -25,6 +25,7 @@ Written by Brian Fox (bfox@ai.mit.edu). */ #include <stdio.h> +#include <stdlib.h> #include <sys/types.h> #include "terminal.h" #include "termdep.h" @@ -108,6 +109,12 @@ static char *term_invbeg; /* The string to turn off inverse mode, if this term has one. */ static char *term_invend; +/* The string to turn on keypad transmit mode, if this term has one. */ +static char *term_ks; + +/* The string to turn off keypad transmit mode, if this term has one. */ +static char *term_ke; + static void output_character_function (c) int c; @@ -127,6 +134,8 @@ static void terminal_begin_using_terminal () { send_to_terminal (term_begin_use); + if (term_ks) + send_to_terminal(term_ks); } /* Tell the terminal that we will not be doing any more cursor addressable @@ -134,6 +143,8 @@ terminal_begin_using_terminal () static void terminal_end_using_terminal () { + if (term_ke) + send_to_terminal(term_ke); send_to_terminal (term_end_use); } @@ -169,6 +180,11 @@ char *term_ku = (char *)NULL; char *term_kd = (char *)NULL; char *term_kr = (char *)NULL; char *term_kl = (char *)NULL; +char *term_kP = (char *)NULL; +char *term_kN = (char *)NULL; +char *term_kh = (char *)NULL; +char *term_kH = (char *)NULL; + /* Move the cursor to the terminal location of X and Y. */ void @@ -500,6 +516,7 @@ terminal_initialize_terminal (terminal_name) term_cr = "\r"; term_up = term_dn = audible_bell = visible_bell = (char *)NULL; term_ku = term_kd = term_kl = term_kr = (char *)NULL; + term_kP = term_kN = term_kh = term_kH = (char *)NULL; return; } @@ -566,11 +583,19 @@ terminal_initialize_terminal (terminal_name) term_mo = (char *)NULL; } - /* Attempt to find the arrow keys. */ + /* Attempt to find the arrow keys. */ term_ku = tgetstr ("ku", &buffer); term_kd = tgetstr ("kd", &buffer); term_kr = tgetstr ("kr", &buffer); term_kl = tgetstr ("kl", &buffer); + term_kP = tgetstr ("kP", &buffer); + term_kN = tgetstr ("kN", &buffer); + term_kh = tgetstr ("kh", &buffer); + term_kH = tgetstr ("kH", &buffer); + + /* Enable keypad and cursor keys if ks defined */ + term_ks = tgetstr ("ks", &buffer); + term_ke = tgetstr ("ke", &buffer); /* If this terminal is not cursor addressable, then it is really dumb. */ if (!term_goto) |