mirror of
				https://github.com/neovim/neovim.git
				synced 2025-10-26 12:27:24 +00:00 
			
		
		
		
	insert: make <cmd> mapping work in completion (CTRL-X) mode
This commit is contained in:
		| @@ -3195,7 +3195,8 @@ static bool ins_compl_prep(int c) | |||||||
|  |  | ||||||
|   /* Ignore end of Select mode mapping and mouse scroll buttons. */ |   /* Ignore end of Select mode mapping and mouse scroll buttons. */ | ||||||
|   if (c == K_SELECT || c == K_MOUSEDOWN || c == K_MOUSEUP |   if (c == K_SELECT || c == K_MOUSEDOWN || c == K_MOUSEUP | ||||||
|       || c == K_MOUSELEFT || c == K_MOUSERIGHT || c == K_EVENT) { |       || c == K_MOUSELEFT || c == K_MOUSERIGHT || c == K_EVENT | ||||||
|  |       || c == K_COMMAND) { | ||||||
|     return retval; |     return retval; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -29,6 +29,9 @@ describe('mappings with <Cmd>', function() | |||||||
|       [5] = {background = Screen.colors.LightGrey}, |       [5] = {background = Screen.colors.LightGrey}, | ||||||
|       [6] = {foreground = Screen.colors.Blue1}, |       [6] = {foreground = Screen.colors.Blue1}, | ||||||
|       [7] = {bold = true, reverse = true}, |       [7] = {bold = true, reverse = true}, | ||||||
|  |       [8] = {background = Screen.colors.WebGray}, | ||||||
|  |       [9] = {background = Screen.colors.LightMagenta}, | ||||||
|  |       [10] = {foreground = Screen.colors.Red}, | ||||||
|     }) |     }) | ||||||
|     screen:attach() |     screen:attach() | ||||||
|  |  | ||||||
| @@ -656,6 +659,37 @@ describe('mappings with <Cmd>', function() | |||||||
|     eq('n', eval('mode(1)')) |     eq('n', eval('mode(1)')) | ||||||
|   end) |   end) | ||||||
|  |  | ||||||
|  |   it('works in insert completion (Ctrl-X) mode', function() | ||||||
|  |     feed('os<c-x><c-n>') | ||||||
|  |     screen:expect([[ | ||||||
|  |       some short lines                                                 | | ||||||
|  |       some^                                                             | | ||||||
|  |       {8:some           }                                                  | | ||||||
|  |       {9:short          }{1:                                                  }| | ||||||
|  |       {1:~                                                                }| | ||||||
|  |       {1:~                                                                }| | ||||||
|  |       {1:~                                                                }| | ||||||
|  |       {4:-- Keyword Local completion (^N^P) }{3:match 1 of 2}                  | | ||||||
|  |     ]]) | ||||||
|  |  | ||||||
|  |     feed('<f3>') | ||||||
|  |     eq('ic', eval('m')) | ||||||
|  |  | ||||||
|  |     -- ensure a redraw, this would have moved the cursor | ||||||
|  |     -- instead if CTRL-X mode was left. | ||||||
|  |     feed('<up>') | ||||||
|  |     screen:expect([[ | ||||||
|  |       some short lines                                                 | | ||||||
|  |       some^                                                             | | ||||||
|  |       {9:some           }                                                  | | ||||||
|  |       {9:short          }{1:                                                  }| | ||||||
|  |       {1:~                                                                }| | ||||||
|  |       {1:~                                                                }| | ||||||
|  |       {1:~                                                                }| | ||||||
|  |       {4:-- Keyword Local completion (^N^P) }{10:Back at original}              | | ||||||
|  |     ]]) | ||||||
|  |   end) | ||||||
|  |  | ||||||
|   it('works in cmdline mode', function() |   it('works in cmdline mode', function() | ||||||
|     feed(':text<F3>') |     feed(':text<F3>') | ||||||
|     eq('c', eval('m')) |     eq('c', eval('m')) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Björn Linse
					Björn Linse