mirror of
				https://github.com/neovim/neovim.git
				synced 2025-10-26 12:27:24 +00:00 
			
		
		
		
	fix(lua): correct return value for on_key with no arguments
(cherry picked from commit 3edc8417f0)
			
			
This commit is contained in:
		 altermo
					altermo
				
			
				
					committed by
					
						![github-actions[bot]](/assets/img/avatar_default.png) github-actions[bot]
						github-actions[bot]
					
				
			
			
				
	
			
			
			![github-actions[bot]](/assets/img/avatar_default.png) github-actions[bot]
						github-actions[bot]
					
				
			
						parent
						
							412225c02a
						
					
				
				
					commit
					1413f3a971
				
			| @@ -544,7 +544,7 @@ local on_key_cbs = {} | ||||
| ---@note {fn} will receive the keys after mappings have been evaluated | ||||
| function vim.on_key(fn, ns_id) | ||||
|   if fn == nil and ns_id == nil then | ||||
|     return #on_key_cbs | ||||
|     return vim.tbl_count(on_key_cbs) | ||||
|   end | ||||
|  | ||||
|   vim.validate({ | ||||
|   | ||||
| @@ -2339,6 +2339,12 @@ describe('lua stdlib', function() | ||||
|     end) | ||||
|  | ||||
|     it('allows removing on_key listeners', function() | ||||
|       -- Create some unused namespaces | ||||
|       meths.create_namespace('unused1') | ||||
|       meths.create_namespace('unused2') | ||||
|       meths.create_namespace('unused3') | ||||
|       meths.create_namespace('unused4') | ||||
|  | ||||
|       insert([[hello world]]) | ||||
|  | ||||
|       exec_lua [[ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user