texinfo-commits
[Top][All Lists]
Advanced

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

[5686] don't repeat key bindings with DEL


From: Gavin D. Smith
Subject: [5686] don't repeat key bindings with DEL
Date: Sat, 28 Jun 2014 18:37:17 +0000

Revision: 5686
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=5686
Author:   gavin
Date:     2014-06-28 18:37:16 +0000 (Sat, 28 Jun 2014)
Log Message:
-----------
don't repeat key bindings with DEL

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/info/infodoc.c
    trunk/info/infomap.c
    trunk/info/terminal.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2014-06-28 17:26:15 UTC (rev 5685)
+++ trunk/ChangeLog     2014-06-28 18:37:16 UTC (rev 5686)
@@ -23,6 +23,16 @@
        * info/pcterm.c (pc_initialize_terminal): Use term_kD instead of
        term_kx.
 
+       * info/infomap.c: (read_init_file): Correct condition.
+       (default_emacs_like_info_keys, default_emacs_like_ea_keys)
+       (default_vi_like_info_keys, default_vi_like_ea_keys): Use KEY_DELETE
+       instead of DEL to prevent duplicate key bindings in help buffer.
+       * info/terminal.c (initialize_bytemap): Interpret a DEL character as
+       the Delete key.
+       (terminal_initialize_terminal): Remove duplicated assignments.
+       * info/infodoc.c (pretty_keyseq_internal): Merged into pretty_keyseq.
+       (pretty_keyseq): Use struct text_buffer.
+
 2014-06-28  Gavin Smith  <address@hidden>
 
        * info/infokey.h:

Modified: trunk/info/infodoc.c
===================================================================
--- trunk/info/infodoc.c        2014-06-28 17:26:15 UTC (rev 5685)
+++ trunk/info/infodoc.c        2014-06-28 18:37:16 UTC (rev 5686)
@@ -618,37 +618,32 @@
   return rep;
 }
 
-/* Return the pretty printable string which represents KEYSEQ. */
-
-static void pretty_keyseq_internal (int *keyseq, char *rep);
-
+/* Return the pretty printable string which represents KEYSEQ.  Return
+   value should not be freed by caller. */
 char *
 pretty_keyseq (int *keyseq)
 {
-  static char keyseq_rep[200];
+  static struct text_buffer rep = {};
 
-  keyseq_rep[0] = '\0';
-  if (*keyseq)
-    pretty_keyseq_internal (keyseq, keyseq_rep);
-  return keyseq_rep;
-}
+  if (!text_buffer_base (&rep))
+    text_buffer_init (&rep);
+  else
+    text_buffer_reset (&rep);
 
-static void
-pretty_keyseq_internal (int *keyseq, char *rep)
-{
   if (!*keyseq)
-    return;
+    return "";
 
   while (1)
     {
-      strcat (rep, pretty_keyname (keyseq[0]));
+      text_buffer_printf (&rep, "%s", pretty_keyname (keyseq[0]));
       keyseq++;
 
       if (!*keyseq)
         break;
 
-      strcat (rep, " ");
+      text_buffer_add_char (&rep, ' ');
     }
+  return text_buffer_base (&rep);
 }
 
 /* Return a pointer to the last character in s that is found in f. */

Modified: trunk/info/infomap.c
===================================================================
--- trunk/info/infomap.c        2014-06-28 17:26:15 UTC (rev 5685)
+++ trunk/info/infomap.c        2014-06-28 18:37:16 UTC (rev 5686)
@@ -244,7 +244,6 @@
   'q', NUL,                       A_info_quit,
   'x', NUL,                       A_info_delete_window,
   SPC, NUL,                       A_info_scroll_forward,
-  DEL, NUL,                       A_info_scroll_backward,
   '{', NUL,                       A_info_search_previous,
   '}', NUL,                       A_info_search_next,
   CONTROL('g'), NUL,              A_info_abort_key,
@@ -274,7 +273,7 @@
   KEYMAP_META('y'), NUL,                 A_ea_yank_pop,
   KEYMAP_META('?'), NUL,                 A_ea_possible_completions,
   KEYMAP_META(TAB), NUL,                 A_ea_tab_insert,
-  KEYMAP_META(DEL), NUL,                 A_ea_backward_kill_word,
+  KEYMAP_META(KEY_DELETE), NUL,                 A_ea_backward_kill_word,
   CONTROL('a'), NUL,              A_ea_beg_of_line,
   CONTROL('b'), NUL,              A_ea_backward,
   CONTROL('d'), NUL,              A_ea_delete,
@@ -297,26 +296,20 @@
 #ifdef __MSDOS__
   /* PC users will lynch me if I don't give them their usual DEL
      effect...  */
-  DEL, NUL,                       A_ea_delete,
+  KEY_DELETE, NUL,                       A_ea_delete,
 #else
-  DEL, NUL,                       A_ea_rubout,
+  KEY_DELETE, NUL,                       A_ea_rubout,
 #endif
   CONTROL('x'), 'o', NUL,         A_info_next_window,
-  CONTROL('x'), DEL, NUL,         A_ea_backward_kill_line,
+  CONTROL('x'), KEY_DELETE, NUL,         A_ea_backward_kill_line,
 
   KEY_RIGHT_ARROW, NUL,           A_ea_forward,
   KEY_LEFT_ARROW, NUL,            A_ea_backward,
   ESC, KEY_RIGHT_ARROW, NUL,   A_ea_forward_word,
   ESC, KEY_LEFT_ARROW, NUL,    A_ea_backward_word,
-#ifdef __MSDOS__
-  KEY_DELETE, NUL,               A_ea_delete,
-#else
-  KEY_DELETE, NUL,               A_ea_rubout,
-#endif
   KEY_HOME, NUL,                 A_ea_beg_of_line,
   KEY_END, NUL,                  A_ea_end_of_line,
   ESC, KEY_DELETE, NUL,  A_ea_backward_kill_word,
-  CONTROL('x'), KEY_DELETE, NUL, A_ea_backward_kill_line,
 };
 
 
@@ -430,7 +423,6 @@
   ESC, 'v', NUL,                  A_info_scroll_backward_page_only,
   ESC, 'x', NUL,                  A_info_execute_command,
   KEYMAP_META('x'), NUL,                 A_info_execute_command,
-  ESC, DEL, NUL,                  A_info_scroll_other_window_backward,
   CONTROL('x'), CONTROL('b'), NUL,        A_list_visited_nodes,
   CONTROL('x'), CONTROL('c'), NUL,        A_info_quit,
   CONTROL('x'), CONTROL('f'), NUL,        A_info_view_file,
@@ -457,6 +449,7 @@
 
   KEY_PAGE_UP, NUL,             A_info_scroll_backward,
   KEY_PAGE_DOWN, NUL,           A_info_scroll_forward,
+  KEY_DELETE, NUL,              A_info_scroll_backward,
   KEY_RIGHT_ARROW, NUL,         A_info_scroll_forward_page_only,
   KEY_LEFT_ARROW, NUL,          A_info_scroll_backward_page_only,
   KEY_HOME, NUL,                A_info_beginning_of_node,
@@ -474,7 +467,6 @@
   'q', NUL,                       A_info_quit,
   'x', NUL,                       A_info_delete_window,
   SPC, NUL,                       A_info_scroll_forward,
-  DEL, NUL,                       A_info_scroll_backward,
   '{', NUL,                       A_info_search_previous,
   '}', NUL,                       A_info_search_next,
   KEY_UP_ARROW, NUL,    A_info_up_line,
@@ -540,15 +532,7 @@
   SPC, NUL,                       A_ea_complete,
   TAB, NUL,                       A_ea_complete,
   '?', NUL,                       A_ea_possible_completions,
-#ifdef __MSDOS__
-  /* PC users will lynch me if I don't give them their usual DEL
-     effect...  */
-  DEL, NUL,                       A_ea_delete,
-#else
-        DEL, NUL,                       A_ea_rubout,
-#endif
   CONTROL('x'), 'o', NUL,         A_info_next_window,
-  CONTROL('x'), DEL, NUL,         A_ea_backward_kill_line,
   
   KEY_RIGHT_ARROW, NUL,         A_ea_forward,
   KEY_LEFT_ARROW, NUL,          A_ea_backward,
@@ -730,7 +714,7 @@
           info_keymap[i].function = InfoCmd (info_do_lowercase_version);
         }
 
-      if (info_keymap[KEYMAP_META(i)].function)
+      if (!info_keymap[KEYMAP_META(i)].function)
         {
           info_keymap[KEYMAP_META(i)].type = ISFUNC;
           info_keymap[KEYMAP_META(i)].function

Modified: trunk/info/terminal.c
===================================================================
--- trunk/info/terminal.c       2014-06-28 17:26:15 UTC (rev 5685)
+++ trunk/info/terminal.c       2014-06-28 18:37:16 UTC (rev 5686)
@@ -545,6 +545,12 @@
       byte_seq_to_key[i].next = 0;
     }
 
+  /* Hard-code octal 177 = delete.  Either 177 or the term_kD sequence will
+     result in a delete key being registered. */
+  byte_seq_to_key['\177'].type = BYTEMAP_KEY;
+  byte_seq_to_key['\177'].key = KEY_DELETE;
+  byte_seq_to_key['\177'].next = 0;
+
   /* For each special key, record its byte sequence. */
   for (i = 0; i < sizeof (keys) / sizeof (*keys); i++)
     {
@@ -715,10 +721,6 @@
   term_ki = tgetstr ("kI", &buffer);
   term_kD = tgetstr ("kD", &buffer);
 
-  /* Home and end keys. */
-  term_kh = tgetstr ("kh", &buffer);
-  term_ke = tgetstr ("@7", &buffer);
-
   term_bt = tgetstr ("bt", &buffer);
 
   initialize_byte_map ();




reply via email to

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