From owner-freebsd-bugs Tue Jul 4 08:47:01 1995 Return-Path: bugs-owner Received: (from majordom@localhost) by freefall.cdrom.com (8.6.10/8.6.6) id IAA28865 for bugs-outgoing; Tue, 4 Jul 1995 08:47:01 -0700 Received: from ghpc6.ihf.rwth-aachen.de (ghpc6.ihf.RWTH-Aachen.DE [134.130.90.6]) by freefall.cdrom.com (8.6.10/8.6.6) with ESMTP id IAA28857 for ; Tue, 4 Jul 1995 08:46:53 -0700 Received: (from thomas@localhost) by ghpc6.ihf.rwth-aachen.de (8.6.8/8.6.6) id RAA17152 for bugs@freebsd.org; Tue, 4 Jul 1995 17:46:29 +0200 From: Thomas Gellekum Message-Id: <199507041546.RAA17152@ghpc6.ihf.rwth-aachen.de> Subject: info and cursor keys (PR gnu/289) To: bugs@freebsd.org Date: Tue, 4 Jul 1995 17:46:28 +0200 (MET DST) Organization: Institut f. Hochfrequenztechnik, RWTH Aachen X-Mailer: ELM [version 2.4 PL23] MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Content-Length: 7879 Sender: bugs-owner@freebsd.org Precedence: bulk Moin moin, 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. For those who want to try the patch: I had to disable the timer in session.c to get good response times to keystrokes from the cursor keys. Unfortunately this has the side effect that info shows the received escape sequence in its bottom line. If you don't like that you can comment out the next two lines (if (!ready) ...). tg --------------texinfo.diff---------------- diff -cr texinfo-3.6.orig/info/infomap.c texinfo-3.6/info/infomap.c *** texinfo-3.6.orig/info/infomap.c Fri Jun 16 20:00:19 1995 --- texinfo-3.6/info/infomap.c Sun Jul 2 13:30:05 1995 *************** *** 25,30 **** --- 25,36 ---- #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,269 **** map['o'].function = info_next_window; map['t'].function = info_tile_windows; map['w'].function = info_toggle_wrap; } ! --- 270,328 ---- 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; ! } diff -cr texinfo-3.6.orig/info/session.c texinfo-3.6/info/session.c *** texinfo-3.6.orig/info/session.c Fri Jun 16 20:00:53 1995 --- texinfo-3.6/info/session.c Sun Jul 2 14:09:51 1995 *************** *** 27,32 **** --- 27,33 ---- #endif /* HAVE_SYS_FILE_H */ #include #include + #include #if defined (HAVE_SYS_TIME_H) # include *************** *** 3849,3856 **** FD_ZERO (&readfds); FD_SET (fileno (info_input_stream), &readfds); ! timer.tv_sec = 1; ! timer.tv_usec = 750; ready = select (1, &readfds, (fd_set *)NULL, (fd_set *)NULL, &timer); #endif /* FD_SET */ } --- 3850,3857 ---- FD_ZERO (&readfds); FD_SET (fileno (info_input_stream), &readfds); ! timer.tv_sec = 0; ! timer.tv_usec = 0; ready = select (1, &readfds, (fd_set *)NULL, (fd_set *)NULL, &timer); #endif /* FD_SET */ } diff -cr texinfo-3.6.orig/info/terminal.c texinfo-3.6/info/terminal.c *** texinfo-3.6.orig/info/terminal.c Fri Jun 16 20:01:01 1995 --- texinfo-3.6/info/terminal.c Sun Jul 2 13:54:04 1995 *************** *** 26,31 **** --- 26,32 ---- Written by Brian Fox (bfox@ai.mit.edu). */ #include + #include #include #include "terminal.h" #include "termdep.h" *************** *** 109,114 **** --- 110,121 ---- /* 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,133 **** --- 135,142 ---- 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 *************** *** 136,141 **** --- 145,152 ---- terminal_end_using_terminal () { + if (term_ke) + send_to_terminal(term_ke); send_to_terminal (term_end_use); } /* **************************************************************** */ *************** *** 166,172 **** --- 177,185 ---- 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,503 **** --- 511,517 ---- 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,574 **** term_mo = (char *)NULL; } ! /* 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); /* If this terminal is not cursor addressable, then it is really dumb. */ if (!term_goto) --- 578,596 ---- term_mo = (char *)NULL; } ! /* 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)