mirror of
				https://github.com/vim/vim.git
				synced 2025-10-30 09:47:20 -04:00 
			
		
		
		
	patch 9.1.1389: completion: still some issue when 'isexpand' contains a space
Problem:  Cannot get completion startcol when space is not the first
          trigger character (after v9.1.1383)
Solution: Detect the next comma followed by a space in the option string
          and use in next compare loop (glepnir)
closes: #17311
Signed-off-by: glepnir <glephunter@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
			
			
This commit is contained in:
		
				
					committed by
					
						 Christian Brabandt
						Christian Brabandt
					
				
			
			
				
	
			
			
			
						parent
						
							c6c72d165c
						
					
				
				
					commit
					08db2f4f28
				
			| @@ -3661,19 +3661,27 @@ f_complete_match(typval_T *argvars, typval_T *rettv) | |||||||
|     else |     else | ||||||
|     { |     { | ||||||
| 	char_u	    *p = ise; | 	char_u	    *p = ise; | ||||||
|  | 	char_u	    *p_space = NULL; | ||||||
|  |  | ||||||
| 	cur_end = before_cursor + (int)STRLEN(before_cursor); | 	cur_end = before_cursor + (int)STRLEN(before_cursor); | ||||||
|  |  | ||||||
| 	while (*p != NUL) | 	while (*p != NUL) | ||||||
| 	{ | 	{ | ||||||
| 	    int	    len = 0; | 	    int	    len = 0; | ||||||
| 	    if (*p == ',' && *(p+1) == ' ' && (*(p+2) == ',' || *(p+2) == NUL)) | 	    if (p_space) | ||||||
| 	    { | 	    { | ||||||
| 		part[0] = ' '; | 		len = p - p_space - 1; | ||||||
| 		len = 1; | 		memcpy(part, p_space + 1, len); | ||||||
| 		p++; | 		p_space = NULL; | ||||||
| 	    } | 	    } | ||||||
| 	    else | 	    else | ||||||
|  | 	    { | ||||||
|  | 		char_u *next_comma = vim_strchr((*p == ',') ? p + 1 : p, ','); | ||||||
|  | 		if (next_comma && *(next_comma + 1) == ' ') | ||||||
|  | 		    p_space = next_comma; | ||||||
|  |  | ||||||
| 		len = copy_option_part(&p, part, MAXPATHL, ","); | 		len = copy_option_part(&p, part, MAXPATHL, ","); | ||||||
|  | 	    } | ||||||
|  |  | ||||||
| 	    if (len > 0 && len <= col) | 	    if (len > 0 && len <= col) | ||||||
| 	    { | 	    { | ||||||
|   | |||||||
| @@ -4507,6 +4507,13 @@ func Test_complete_match() | |||||||
|   set ise=\ ,= |   set ise=\ ,= | ||||||
|   call feedkeys("Sif true  \<ESC>:let g:result=complete_match()\<CR>", 'tx') |   call feedkeys("Sif true  \<ESC>:let g:result=complete_match()\<CR>", 'tx') | ||||||
|   call assert_equal([[8, ' ']], g:result) |   call assert_equal([[8, ' ']], g:result) | ||||||
|  |   call feedkeys("Slet a = \<ESC>:let g:result=complete_match()\<CR>", 'tx') | ||||||
|  |   call assert_equal([[7, '=']], g:result) | ||||||
|  |   set ise={,\ ,= | ||||||
|  |   call feedkeys("Sif true  \<ESC>:let g:result=complete_match()\<CR>", 'tx') | ||||||
|  |   call assert_equal([[8, ' ']], g:result) | ||||||
|  |   call feedkeys("S{ \<ESC>:let g:result=complete_match()\<CR>", 'tx') | ||||||
|  |   call assert_equal([[1, '{']], g:result) | ||||||
|  |  | ||||||
|   bw! |   bw! | ||||||
|   unlet g:result |   unlet g:result | ||||||
|   | |||||||
| @@ -704,6 +704,8 @@ static char *(features[]) = | |||||||
|  |  | ||||||
| static int included_patches[] = | static int included_patches[] = | ||||||
| {   /* Add new patch number below this line */ | {   /* Add new patch number below this line */ | ||||||
|  | /**/ | ||||||
|  |     1389, | ||||||
| /**/ | /**/ | ||||||
|     1388, |     1388, | ||||||
| /**/ | /**/ | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user