mirror of
				https://github.com/cmderdev/cmder.git
				synced 2025-10-31 17:32:27 +08:00 
			
		
		
		
	add ~ match to vendor/clink.lua/
This commit is contained in:
		
							
								
								
									
										17
									
								
								vendor/clink.lua
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										17
									
								
								vendor/clink.lua
									
									
									
									
										vendored
									
									
								
							| @@ -385,7 +385,24 @@ local function svn_prompt_filter() | |||||||
|     return false |     return false | ||||||
| end | end | ||||||
|  |  | ||||||
|  | local function tilde_match (text, f, l) | ||||||
|  |     if text == '~' then | ||||||
|  |         clink.add_match(clink.get_env('userprofile')) | ||||||
|  |         clink.matches_are_files() | ||||||
|  |         return true | ||||||
|  |     end | ||||||
|  |  | ||||||
|  |     if text:sub(1, 1) == '~' then | ||||||
|  |         clink.add_match(string.gsub(text, "~", clink.get_env('userprofile'), 1)) | ||||||
|  |         -- second match prevents adding a space so we can look for more matches | ||||||
|  |         clink.add_match(string.gsub(text, "~", clink.get_env('userprofile'), 1) .. '+') | ||||||
|  |         clink.matches_are_files() | ||||||
|  |         return true | ||||||
|  |     end | ||||||
|  | end | ||||||
|  |  | ||||||
| -- insert the set_prompt at the very beginning so that it runs first | -- insert the set_prompt at the very beginning so that it runs first | ||||||
|  | clink.register_match_generator(tilde_match, 1) | ||||||
| clink.prompt.register_filter(set_prompt_filter, 1) | clink.prompt.register_filter(set_prompt_filter, 1) | ||||||
| clink.prompt.register_filter(hg_prompt_filter, 50) | clink.prompt.register_filter(hg_prompt_filter, 50) | ||||||
| clink.prompt.register_filter(git_prompt_filter, 50) | clink.prompt.register_filter(git_prompt_filter, 50) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user