better fix for #1265

This commit is contained in:
Benjamin Staneck 2018-06-07 18:29:48 +02:00
parent 6c016788d4
commit e3cdf43afc

9
vendor/clink.lua vendored
View File

@ -41,13 +41,19 @@ local function set_prompt_filter()
-- color codes: "\x1b[1;37;40m" -- color codes: "\x1b[1;37;40m"
local cmder_prompt = "\x1b[1;32;40m{cwd} {git}{hg}{svn} \n\x1b[1;39;40m{lamb} \x1b[0m" local cmder_prompt = "\x1b[1;32;40m{cwd} {git}{hg}{svn} \n\x1b[1;39;40m{lamb} \x1b[0m"
local lambda = "λ" local lambda = "λ"
cwd = string.gsub(cwd, "%%", "{percent}")
cmder_prompt = string.gsub(cmder_prompt, "{cwd}", cwd) cmder_prompt = string.gsub(cmder_prompt, "{cwd}", cwd)
if env ~= nil then if env ~= nil then
lambda = "("..env..") "..lambda lambda = "("..env..") "..lambda
end end
clink.prompt.value = string.gsub(cmder_prompt, "{lamb}", lambda) clink.prompt.value = string.gsub(cmder_prompt, "{lamb}", lambda)
end end
local function percent_prompt_filter()
clink.prompt.value = string.gsub(clink.prompt.value, "{percent}", "%%")
end
--- ---
-- Resolves closest directory location for specified directory. -- Resolves closest directory location for specified directory.
-- Navigates subsequently up one level and tries to find specified directory -- Navigates subsequently up one level and tries to find specified directory
@ -235,7 +241,7 @@ end
-- Get the status of working dir -- Get the status of working dir
-- @return {bool} -- @return {bool}
--- ---
function get_svn_status() local function get_svn_status()
local file = io.popen("svn status -q") local file = io.popen("svn status -q")
for line in file:lines() do for line in file:lines() do
file:close() file:close()
@ -340,6 +346,7 @@ 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)
clink.prompt.register_filter(svn_prompt_filter, 50) clink.prompt.register_filter(svn_prompt_filter, 50)
clink.prompt.register_filter(percent_prompt_filter, 51)
local completions_dir = clink.get_env('CMDER_ROOT')..'/vendor/clink-completions/' local completions_dir = clink.get_env('CMDER_ROOT')..'/vendor/clink-completions/'
for _,lua_module in ipairs(clink.find_files(completions_dir..'*.lua')) do for _,lua_module in ipairs(clink.find_files(completions_dir..'*.lua')) do