I added a few lines of code to the latest info browser in the
texinfo-3.6 distribution to enable the use of the cursor keys. Since there is an open problem report (gnu/289) for this it might be of interest for (some of) you. I (Joerg) have also added a minor hack that makes info recognizing a window size change while it has been suspended. Submitted by: thomas@ghpc8.ihf.rwth-aachen.de (Thomas Gellekum)
This commit is contained in:
parent
aed5ecb7bf
commit
c3081fb7f9
@ -1,5 +1,6 @@
|
||||
# Texinfo defaults.
|
||||
# $Id$
|
||||
# $Id: Makefile.inc,v 1.2 1994/09/15 12:09:36 jkh Exp $
|
||||
|
||||
INFODIR?= /usr/share/info
|
||||
|
||||
CFLAGS+= -O2 -pipe
|
||||
|
@ -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,6 +270,59 @@ initialize_info_keymaps ()
|
||||
map['o'].function = info_next_window;
|
||||
map['t'].function = info_tile_windows;
|
||||
map['w'].function = info_toggle_wrap;
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include <sys/file.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#if defined (HAVE_SYS_TIME_H)
|
||||
# include <sys/time.h>
|
||||
@ -3751,8 +3752,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 */
|
||||
}
|
||||
|
@ -71,7 +71,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 ()
|
||||
@ -84,7 +84,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);
|
||||
@ -150,6 +153,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:
|
||||
{
|
||||
|
@ -26,6 +26,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"
|
||||
@ -109,6 +110,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;
|
||||
@ -128,6 +135,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
|
||||
@ -135,6 +144,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);
|
||||
}
|
||||
|
||||
@ -166,7 +177,9 @@ int terminal_use_visible_bell_p = 0;
|
||||
int terminal_can_scroll = 0;
|
||||
|
||||
/* The key sequences output by the arrow keys, if this terminal has any. */
|
||||
/* Also use PageUp, PageDown, Home, End, if available. */
|
||||
char *term_ku, *term_kd, *term_kr, *term_kl;
|
||||
char *term_kP, *term_kN, *term_kh, *term_kH;
|
||||
|
||||
/* Move the cursor to the terminal location of X and Y. */
|
||||
void
|
||||
@ -498,6 +511,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;
|
||||
}
|
||||
|
||||
@ -564,11 +578,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)
|
||||
|
Loading…
Reference in New Issue
Block a user