Karsten Hopp 402abc
To: vim_dev@googlegroups.com
Karsten Hopp 402abc
Subject: Patch 7.4.485
Karsten Hopp 402abc
Fcc: outbox
Karsten Hopp 402abc
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 402abc
Mime-Version: 1.0
Karsten Hopp 402abc
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 402abc
Content-Transfer-Encoding: 8bit
Karsten Hopp 402abc
------------
Karsten Hopp 402abc
Karsten Hopp 402abc
Patch 7.4.485 (after 7.4.484)
Karsten Hopp 402abc
Problem:    Abbreviations don't work. (Toothpik)
Karsten Hopp 402abc
Solution:   Move the length computation inside the for loop.  Compare against
Karsten Hopp 402abc
	    the unescaped key.
Karsten Hopp 402abc
Files:	    src/getchar.c
Karsten Hopp 402abc
Karsten Hopp 402abc
Karsten Hopp 402abc
*** ../vim-7.4.484/src/getchar.c	2014-10-21 18:17:05.638274024 +0200
Karsten Hopp 402abc
--- src/getchar.c	2014-10-21 19:30:46.262283680 +0200
Karsten Hopp 402abc
***************
Karsten Hopp 402abc
*** 4443,4449 ****
Karsten Hopp 402abc
  #endif
Karsten Hopp 402abc
      int		is_id = TRUE;
Karsten Hopp 402abc
      int		vim_abbr;
Karsten Hopp 402abc
-     int		qlen;		/* length of q, CSI/K_SPECIAL unescaped */
Karsten Hopp 402abc
  
Karsten Hopp 402abc
      if (typebuf.tb_no_abbr_cnt)	/* abbrev. are not recursive */
Karsten Hopp 402abc
  	return FALSE;
Karsten Hopp 402abc
--- 4443,4448 ----
Karsten Hopp 402abc
***************
Karsten Hopp 402abc
*** 4521,4549 ****
Karsten Hopp 402abc
  #else
Karsten Hopp 402abc
  	mp = first_abbr;
Karsten Hopp 402abc
  #endif
Karsten Hopp 402abc
- 	qlen = mp->m_keylen;
Karsten Hopp 402abc
- 	if (vim_strbyte(mp->m_keys, K_SPECIAL) != NULL)
Karsten Hopp 402abc
- 	{
Karsten Hopp 402abc
- 	    char_u	*q = vim_strsave(mp->m_keys);
Karsten Hopp 402abc
- 
Karsten Hopp 402abc
- 	    /* might have CSI escaped mp->m_keys */
Karsten Hopp 402abc
- 	    if (q != NULL)
Karsten Hopp 402abc
- 	    {
Karsten Hopp 402abc
- 		vim_unescape_csi(q);
Karsten Hopp 402abc
- 		qlen = (int)STRLEN(q);
Karsten Hopp 402abc
- 		vim_free(q);
Karsten Hopp 402abc
- 	    }
Karsten Hopp 402abc
- 	}
Karsten Hopp 402abc
  	for ( ; mp;
Karsten Hopp 402abc
  #ifdef FEAT_LOCALMAP
Karsten Hopp 402abc
  		mp->m_next == NULL ? (mp = mp2, mp2 = NULL) :
Karsten Hopp 402abc
  #endif
Karsten Hopp 402abc
  		(mp = mp->m_next))
Karsten Hopp 402abc
  	{
Karsten Hopp 402abc
  	    /* find entries with right mode and keys */
Karsten Hopp 402abc
! 	    if (       (mp->m_mode & State)
Karsten Hopp 402abc
  		    && qlen == len
Karsten Hopp 402abc
! 		    && !STRNCMP(mp->m_keys, ptr, (size_t)len))
Karsten Hopp 402abc
  		break;
Karsten Hopp 402abc
  	}
Karsten Hopp 402abc
  	if (mp != NULL)
Karsten Hopp 402abc
--- 4520,4553 ----
Karsten Hopp 402abc
  #else
Karsten Hopp 402abc
  	mp = first_abbr;
Karsten Hopp 402abc
  #endif
Karsten Hopp 402abc
  	for ( ; mp;
Karsten Hopp 402abc
  #ifdef FEAT_LOCALMAP
Karsten Hopp 402abc
  		mp->m_next == NULL ? (mp = mp2, mp2 = NULL) :
Karsten Hopp 402abc
  #endif
Karsten Hopp 402abc
  		(mp = mp->m_next))
Karsten Hopp 402abc
  	{
Karsten Hopp 402abc
+ 	    int		qlen = mp->m_keylen;
Karsten Hopp 402abc
+ 	    char_u	*q = mp->m_keys;
Karsten Hopp 402abc
+ 	    int		match;
Karsten Hopp 402abc
+ 
Karsten Hopp 402abc
+ 	    if (vim_strbyte(mp->m_keys, K_SPECIAL) != NULL)
Karsten Hopp 402abc
+ 	    {
Karsten Hopp 402abc
+ 		/* might have CSI escaped mp->m_keys */
Karsten Hopp 402abc
+ 		q = vim_strsave(mp->m_keys);
Karsten Hopp 402abc
+ 		if (q != NULL)
Karsten Hopp 402abc
+ 		{
Karsten Hopp 402abc
+ 		    vim_unescape_csi(q);
Karsten Hopp 402abc
+ 		    qlen = (int)STRLEN(q);
Karsten Hopp 402abc
+ 		}
Karsten Hopp 402abc
+ 	    }
Karsten Hopp 402abc
+ 
Karsten Hopp 402abc
  	    /* find entries with right mode and keys */
Karsten Hopp 402abc
! 	    match =    (mp->m_mode & State)
Karsten Hopp 402abc
  		    && qlen == len
Karsten Hopp 402abc
! 		    && !STRNCMP(q, ptr, (size_t)len);
Karsten Hopp 402abc
! 	    if (q != mp->m_keys)
Karsten Hopp 402abc
! 		vim_free(q);
Karsten Hopp 402abc
! 	    if (match)
Karsten Hopp 402abc
  		break;
Karsten Hopp 402abc
  	}
Karsten Hopp 402abc
  	if (mp != NULL)
Karsten Hopp 402abc
*** ../vim-7.4.484/src/version.c	2014-10-21 18:17:05.638274024 +0200
Karsten Hopp 402abc
--- src/version.c	2014-10-21 19:34:55.338284224 +0200
Karsten Hopp 402abc
***************
Karsten Hopp 402abc
*** 743,744 ****
Karsten Hopp 402abc
--- 743,746 ----
Karsten Hopp 402abc
  {   /* Add new patch number below this line */
Karsten Hopp 402abc
+ /**/
Karsten Hopp 402abc
+     485,
Karsten Hopp 402abc
  /**/
Karsten Hopp 402abc
Karsten Hopp 402abc
-- 
Karsten Hopp 402abc
TALL KNIGHT: We shall say Ni! again to you if you do not appease us.
Karsten Hopp 402abc
ARTHUR:      All right!  What do you want?
Karsten Hopp 402abc
TALL KNIGHT: We want ... a shrubbery!
Karsten Hopp 402abc
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
Karsten Hopp 402abc
Karsten Hopp 402abc
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 402abc
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 402abc
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp 402abc
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///