texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[5684] reading keys in incremental search


From: Gavin D. Smith
Subject: [5684] reading keys in incremental search
Date: Sat, 28 Jun 2014 17:02:15 +0000

Revision: 5684
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=5684
Author:   gavin
Date:     2014-06-28 17:02:12 +0000 (Sat, 28 Jun 2014)
Log Message:
-----------
reading keys in incremental search

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/TODO
    trunk/info/session.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2014-06-28 16:25:33 UTC (rev 5683)
+++ trunk/ChangeLog     2014-06-28 17:02:12 UTC (rev 5684)
@@ -14,6 +14,10 @@
        (section_to_keymaps): Remove flag saying whether to suppress
        default keybindings.
 
+       * info/session.c (incremental_search): Use get_input_key to distinguish
+       between Escape being pressed and arrow keys.  Don't push unused key
+       presses back into input buffer.
+
 2014-06-28  Gavin Smith  <address@hidden>
 
        * info/infokey.h:

Modified: trunk/TODO
===================================================================
--- trunk/TODO  2014-06-28 16:25:33 UTC (rev 5683)
+++ trunk/TODO  2014-06-28 17:02:12 UTC (rev 5684)
@@ -126,7 +126,6 @@
   - Documentation of the HTML customization is missing.
 
 * Info:
-  - The help message does not report Down/Up for next/prev-line.
   - When scrolling through the help text, it should stop at the end, not
     report "No more nodes" and go back to the beginning.
   - It would be nice to be able to specify a preferred key to report in

Modified: trunk/info/session.c
===================================================================
--- trunk/info/session.c        2014-06-28 16:25:33 UTC (rev 5683)
+++ trunk/info/session.c        2014-06-28 17:02:12 UTC (rev 5684)
@@ -3974,7 +3974,7 @@
 static void
 incremental_search (WINDOW *window, int count, unsigned char ignore)
 {
-  unsigned char key;
+  int key;
   int last_search_result, search_result, dir;
   SEARCH_STATE mystate, orig_state;
   char *p;
@@ -4016,7 +4016,7 @@
         }
 
       /* Read a character and dispatch on it. */
-      key = info_get_input_byte ();
+      key = get_input_key ();
       window_get_state (window, &mystate);
 
       if (key == DEL || key == Control ('h'))
@@ -4039,6 +4039,7 @@
         }
       else if (key == Control ('q'))
         {
+          /* User wants to insert a character. */
           key = info_get_input_byte ();
           quoted = 1;
         }
@@ -4049,17 +4050,17 @@
       if (quoted)
         goto insert_and_search;
 
-      if (!Meta_p (key) || key > 32)
+      if (key < KEYMAP_META_BASE || key > 32)
         {
           /* If this key is not a keymap, get its associated function,
-             if any.  If it is a keymap, then it's probably ESC from an
-             arrow key, and we handle that case below.  */
+             if any. */
           char type = info_keymap[key].type;
           func = type == ISFUNC
                  ? InfoFunction(info_keymap[key].function)
                  : NULL;  /* function member is a Keymap if ISKMAP */
 
-          if (isprint (key) || (type == ISFUNC && func == NULL))
+          if (key >= 32 && key < 256
+              && (isprint (key) || (type == ISFUNC && func == NULL)))
             {
             insert_and_search:
 
@@ -4144,28 +4145,13 @@
         {
         exit_search:
           /* The character is not printable, or it has a function which is
-             non-null.  Exit the search, remembering the search string.  If
-             the key is not the same as the isearch_terminate_search_key,
-             then push it into pending input. */
+             non-null.  Exit the search, remembering the search string. */
           if (isearch_string_index && func != (VFunction *) info_abort_key)
             {
               free (last_isearch_accepted);
               last_isearch_accepted = xstrdup (isearch_string);
             }
 
-          /* If the key is the isearch_terminate_search_key, but some buffered
-             input is pending, it is almost invariably because the ESC key is
-             actually the beginning of an escape sequence, like in case they
-             pressed an arrow key.  So don't gobble the ESC key, push it back
-             into pending input.  */
-          /* FIXME: this seems like a kludge!  We need a more reliable
-             mechanism to know when ESC is a separate key and when it is
-             part of an escape sequence.  */
-          if (key != RET  /* Emacs addicts want RET to get lost */
-              && (key != isearch_terminate_search_key
-                  || info_any_buffered_input_p ()))
-            info_set_pending_input (key);
-
           if (func == (VFunction *) info_abort_key)
             {
               if (isearch_states_index)
@@ -4227,7 +4213,7 @@
           else
             search_result = info_search_internal (isearch_string,
                                                   window, dir, case_sensitive,
-                                                 NULL);
+                                                  NULL);
         }
 
       /* If this search failed, and we didn't already have a failed search,




reply via email to

[Prev in Thread] Current Thread [Next in Thread]