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