Matt Wozniski wrote:

> For the life of me, I can't seem to get vim to recognize, eg, <xHome>
> and <Home> as separate keycodes.  For instance...
> 
> vim -u NONE -N
> :set <Home>? <xHome>?
> t_kh <Home>      ^[[1~
> t_kh <Home>      ^[[1~
> :set <Home>=
> :set <xHome>?
> E518: Unknown option: <xHome>?
> 
> Is this intentional behavior?  What's the point of having both <Home>
> and <xHome> if you can't use them to set two different key sequences
> that are both recognized as <Home>?

That's a bug.  This patch should fix it:


*** ../vim-7.2.069/src/gui_mac.c        Sat Aug  9 19:37:28 2008
--- src/gui_mac.c       Sun Dec 14 12:28:26 2008
***************
*** 4966,4972 ****
        char_u      *p_actext;
  
        p_actext = menu->actext;
!       key = find_special_key(&p_actext, &modifiers, /*keycode=*/0);
        if (*p_actext != 0)
            key = 0; /* error: trailing text */
        /* find_special_key() returns a keycode with as many of the
--- 4966,4972 ----
        char_u      *p_actext;
  
        p_actext = menu->actext;
!       key = find_special_key(&p_actext, &modifiers, FALSE, FALSE);
        if (*p_actext != 0)
            key = 0; /* error: trailing text */
        /* find_special_key() returns a keycode with as many of the
*** ../vim-7.2.069/src/misc2.c  Wed Nov 12 13:07:48 2008
--- src/misc2.c Sun Dec 14 12:28:47 2008
***************
*** 2561,2567 ****
      int               key;
      int               dlen = 0;
  
!     key = find_special_key(srcp, &modifiers, keycode);
      if (key == 0)
        return 0;
  
--- 2561,2567 ----
      int               key;
      int               dlen = 0;
  
!     key = find_special_key(srcp, &modifiers, keycode, FALSE);
      if (key == 0)
        return 0;
  
***************
*** 2597,2606 ****
   * returns 0 if there is no match.
   */
      int
! find_special_key(srcp, modp, keycode)
      char_u    **srcp;
      int               *modp;
!     int               keycode; /* prefer key code, e.g. K_DEL instead of DEL 
*/
  {
      char_u    *last_dash;
      char_u    *end_of_name;
--- 2597,2607 ----
   * returns 0 if there is no match.
   */
      int
! find_special_key(srcp, modp, keycode, keep_x_key)
      char_u    **srcp;
      int               *modp;
!     int               keycode;     /* prefer key code, e.g. K_DEL instead of 
DEL */
!     int               keep_x_key;  /* don't translate xHome to Home key */
  {
      char_u    *last_dash;
      char_u    *end_of_name;
***************
*** 2668,2674 ****
            else
            {
                key = get_special_key_code(last_dash + 1);
!               key = handle_x_keys(key);
            }
  
            /*
--- 2669,2676 ----
            else
            {
                key = get_special_key_code(last_dash + 1);
!               if (!keep_x_key)
!                   key = handle_x_keys(key);
            }
  
            /*
*** ../vim-7.2.069/src/option.c Fri Nov 28 21:26:50 2008
--- src/option.c        Sun Dec 14 12:28:56 2008
***************
*** 8328,8334 ****
      {
        --arg;                      /* put arg at the '<' */
        modifiers = 0;
!       key = find_special_key(&arg, &modifiers, TRUE);
        if (modifiers)              /* can't handle modifiers here */
            key = 0;
      }
--- 8328,8334 ----
      {
        --arg;                      /* put arg at the '<' */
        modifiers = 0;
!       key = find_special_key(&arg, &modifiers, TRUE, TRUE);
        if (modifiers)              /* can't handle modifiers here */
            key = 0;
      }
*** ../vim-7.2.069/src/proto/misc2.pro  Thu Jul 24 20:29:37 2008
--- src/proto/misc2.pro Sun Dec 14 12:29:05 2008
***************
*** 59,65 ****
  int handle_x_keys __ARGS((int key));
  char_u *get_special_key_name __ARGS((int c, int modifiers));
  int trans_special __ARGS((char_u **srcp, char_u *dst, int keycode));
! int find_special_key __ARGS((char_u **srcp, int *modp, int keycode));
  int extract_modifiers __ARGS((int key, int *modp));
  int find_special_key_in_table __ARGS((int c));
  int get_special_key_code __ARGS((char_u *name));
--- 59,65 ----
  int handle_x_keys __ARGS((int key));
  char_u *get_special_key_name __ARGS((int c, int modifiers));
  int trans_special __ARGS((char_u **srcp, char_u *dst, int keycode));
! int find_special_key __ARGS((char_u **srcp, int *modp, int keycode, int 
keep_x_key));
  int extract_modifiers __ARGS((int key, int *modp));
  int find_special_key_in_table __ARGS((int c));
  int get_special_key_code __ARGS((char_u *name));

-- 
A hamburger walks into a bar, and the bartender says: "I'm sorry,
but we don't serve food here."

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui