From 56b04fc9ce252c4c1e45023db81c17e667377aba Mon Sep 17 00:00:00 2001 From: dgames Date: Mon, 31 May 2021 10:53:18 -0400 Subject: [PATCH] fix unknown color and code dedup --- vendor/clink.lua | 50 +++++++++++--------------- vendor/cmder_prompt_config.lua.default | 2 +- 2 files changed, 22 insertions(+), 30 deletions(-) diff --git a/vendor/clink.lua b/vendor/clink.lua index 89550c4..2110548 100644 --- a/vendor/clink.lua +++ b/vendor/clink.lua @@ -403,37 +403,29 @@ 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 - -- Has branch => therefore it is a git folder, now figure out status - local gitStatus = get_git_status() - local gitConflict = get_git_conflict() + if git_dir then + 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() - color = colors.dirty - if gitStatus then - color = colors.clean - end + color = colors.dirty + if gitStatus then + color = colors.clean + end - 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 - clink.prompt.value = string.gsub(clink.prompt.value, "{git}", color.."("..verbatim(branch)..")") - return false - end - end + if gitConflict then + color = colors.conflict + end + else + color = colors.nostatus + end + clink.prompt.value = string.gsub(clink.prompt.value, "{git}", color.."("..verbatim(branch)..")") + return false + end end -- No git present or not in git file diff --git a/vendor/cmder_prompt_config.lua.default b/vendor/cmder_prompt_config.lua.default index a33de81..e5ae224 100644 --- a/vendor/cmder_prompt_config.lua.default +++ b/vendor/cmder_prompt_config.lua.default @@ -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