mirror of
				https://github.com/neovim/neovim.git
				synced 2025-10-26 12:27:24 +00:00 
			
		
		
		
	normal: Don't exit CTRL-O mode after processing K_EVENT
This commit is contained in:
		| @@ -7983,8 +7983,14 @@ static void nv_event(cmdarg_T *cap) | |||||||
|   // not safe to perform garbage collection because there could be unreferenced |   // not safe to perform garbage collection because there could be unreferenced | ||||||
|   // lists or dicts being used. |   // lists or dicts being used. | ||||||
|   may_garbage_collect = false; |   may_garbage_collect = false; | ||||||
|  |   bool may_restart = (restart_edit != 0); | ||||||
|   multiqueue_process_events(main_loop.events); |   multiqueue_process_events(main_loop.events); | ||||||
|   finish_op = false; |   finish_op = false; | ||||||
|  |   if (may_restart) { | ||||||
|  |     // Tricky: if restart_edit was set before the handler we are in ctrl-o mode | ||||||
|  |     // but if not, the event should be allow to trigger :startinsert | ||||||
|  |     cap->retval |= CA_COMMAND_BUSY;  // don't call edit() now | ||||||
|  |   } | ||||||
| } | } | ||||||
|  |  | ||||||
| /* | /* | ||||||
|   | |||||||
| @@ -5,6 +5,7 @@ local eval = helpers.eval | |||||||
| local expect = helpers.expect | local expect = helpers.expect | ||||||
| local feed = helpers.feed | local feed = helpers.feed | ||||||
| local insert = helpers.insert | local insert = helpers.insert | ||||||
|  | local meths = helpers.meths | ||||||
|  |  | ||||||
| describe('insert-mode Ctrl-O', function() | describe('insert-mode Ctrl-O', function() | ||||||
|   before_each(clear) |   before_each(clear) | ||||||
| @@ -40,4 +41,14 @@ describe('insert-mode Ctrl-O', function() | |||||||
|     feed('ooo') |     feed('ooo') | ||||||
|     expect('hello oooworld') |     expect('hello oooworld') | ||||||
|   end) |   end) | ||||||
|  |  | ||||||
|  |   it("doesn't cancel Ctrl-O mode when processing event", function() | ||||||
|  |     feed('iHello World<c-o>') | ||||||
|  |     eq({mode='niI', blocking=false}, meths.get_mode()) -- fast event | ||||||
|  |     eq(2, eval('1+1')) -- causes K_EVENT key | ||||||
|  |     eq({mode='niI', blocking=false}, meths.get_mode()) -- still in ctrl-o mode | ||||||
|  |     feed('dd') | ||||||
|  |     eq({mode='i', blocking=false}, meths.get_mode()) -- left ctrl-o mode | ||||||
|  |     expect('') -- executed the command | ||||||
|  |   end) | ||||||
| end) | end) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Björn Linse
					Björn Linse