mirror of
https://github.com/cmderdev/cmder.git
synced 2024-11-10 09:49:12 +08:00
fix unknown color and code dedup
This commit is contained in:
parent
55ff611095
commit
56b04fc9ce
14
vendor/clink.lua
vendored
14
vendor/clink.lua
vendored
@ -403,11 +403,11 @@ local function git_prompt_filter()
|
||||
local git_dir = get_git_dir()
|
||||
local color
|
||||
cmderGitStatusOptIn = get_git_status_setting()
|
||||
if cmderGitStatusOptIn then
|
||||
if git_dir then
|
||||
-- if we're inside of git repo then try to detect current branch
|
||||
local branch = get_git_branch(git_dir)
|
||||
if branch then
|
||||
if cmderGitStatusOptIn then
|
||||
-- if we're inside of git repo then try to detect current branch
|
||||
-- Has branch => therefore it is a git folder, now figure out status
|
||||
local gitStatus = get_git_status()
|
||||
local gitConflict = get_git_conflict()
|
||||
@ -420,21 +420,13 @@ local function git_prompt_filter()
|
||||
if gitConflict then
|
||||
color = colors.conflict
|
||||
end
|
||||
|
||||
clink.prompt.value = string.gsub(clink.prompt.value, "{git}", color.."("..verbatim(branch)..")")
|
||||
return false
|
||||
end
|
||||
end
|
||||
else
|
||||
if git_dir then
|
||||
local branch = get_git_branch(git_dir)
|
||||
if branch then
|
||||
color = colors.nostatus
|
||||
end
|
||||
clink.prompt.value = string.gsub(clink.prompt.value, "{git}", color.."("..verbatim(branch)..")")
|
||||
return false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- No git present or not in git file
|
||||
clink.prompt.value = string.gsub(clink.prompt.value, "{git}", "")
|
||||
|
2
vendor/cmder_prompt_config.lua.default
vendored
2
vendor/cmder_prompt_config.lua.default
vendored
@ -43,4 +43,4 @@ lamb_color = "\x1b[1;30;40m" -- Light Grey = Lambda Color
|
||||
clean_color = "\x1b[1;37;40m"
|
||||
dirty_color = "\x1b[33;3m"
|
||||
conflict_color = "\x1b[31;1m"
|
||||
unknown_color = "\x1b[37;1" -- White = No VCS Status Branch Color
|
||||
unknown_color = "\x1b[37;1m" -- White = No VCS Status Branch Color
|
||||
|
Loading…
Reference in New Issue
Block a user