Bug? xterm-function-keys broken

2008-12-14 Fir de Conversatie Matt Wozniski

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?

~Matt

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



RE: Bug? xterm-function-keys broken

2008-12-14 Fir de Conversatie John Beckett

Matt Wozniski wrote:
 For the life of me, I can't seem to get vim to recognize,
 eg, xHome and Home as separate keycodes.

Perhaps the following is an explanation:
  :help version7
  /xHome

Previously Home and xHome could be mapped separately.
This had the disadvantage that all mappings (with modifiers) had to
be duplicated, since you can't be sure what the keyboard generates.
Now all xHome are internally translated to Home, both for the
keys and for mappings. Also for xEnd, xF1, etc.

John


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



Re: Bug? xterm-function-keys broken

2008-12-14 Fir de Conversatie Matt Wozniski

John Beckett wrote:

 Matt Wozniski wrote:
 For the life of me, I can't seem to get vim to recognize,
 eg, xHome and Home as separate keycodes.

 Perhaps the following is an explanation:
  :help version7
  /xHome

 Previously Home and xHome could be mapped separately.
 This had the disadvantage that all mappings (with modifiers) had to
 be duplicated, since you can't be sure what the keyboard generates.
 Now all xHome are internally translated to Home, both for the
 keys and for mappings. Also for xEnd, xF1, etc.

Yes, I saw that, but I'm pretty sure that only refers to mapping with
:map, and not setting the terminal byte sequence they correspond to
with :set.  I can't see a use for doing :map F1 foo   and:map
xF1 bar, but that's exactly because they should be two separate byte
sequences that mean that the same key was pressed.

~Matt

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



Re: Bug? xterm-function-keys broken

2008-12-14 Fir de Conversatie Matt Wozniski

Bram Moolenaar wrote:

 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...

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

Yes, that seems to fix it for me, xterm on Linux.

~Matt

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



Re: [PATCH] Obj-C filetype detection

2008-12-14 Fir de Conversatie Bram Moolenaar


Patrick Texier wrote:

 I have a patch for gedcom files detection for LifeLines (Unix and
 Windows).

Thanks.  It's better to put patterns that end in a * near the end of
filetype.vim:

*** ../vim-7.2.069/runtime/filetype.vim Wed Aug  6 18:56:36 2008
--- runtime/filetype.vimSun Dec 14 12:54:19 2008
***
*** 704,710 
  au BufNewFile,BufRead *.mo,*.gdmo setf gdmo
  
   Gedcom
! au BufNewFile,BufRead *.ged   setf gedcom
  
   Git
  autocmd BufNewFile,BufRead *.git/COMMIT_EDITMSGsetf gitcommit
--- 707,713 
  au BufNewFile,BufRead *.mo,*.gdmo setf gdmo
  
   Gedcom
! au BufNewFile,BufRead *.ged,lltx.txt  setf gedcom
  
   Git
  autocmd BufNewFile,BufRead *.git/COMMIT_EDITMSGsetf gitcommit
***
*** 2325,2330 
--- 2336,2344 
\|  let b:fvwm_version = 2 | call s:StarSetf('fvwm')
\|endif
  
+  Gedcom
+ au BufNewFile,BufRead /tmp/lltmp* call s:StarSetf('gedcom')
+ 
   GTK RC
  au BufNewFile,BufRead .gtkrc*,gtkrc*  call s:StarSetf('gtkrc')
  


-- 
An indication you must be a manager:
You feel sorry for Dilbert's boss.

 /// 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
-~--~~~~--~~--~--~---



Re: Bug? xterm-function-keys broken

2008-12-14 Fir de Conversatie Bram Moolenaar


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.cSat 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.cSun 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