diff options
author | Grigory Petrov <grigory.v.p@gmail.com> | 2015-08-26 14:37:43 +0300 |
---|---|---|
committer | Grigory Petrov <grigory.v.p@gmail.com> | 2015-08-26 14:37:43 +0300 |
commit | 637c573f7324538f27cd8a6869193e1364d75e76 (patch) | |
tree | 28d23017923d34e89098650599a567cce291556d | |
parent | 0fe65ed830b5d1cdc5189230139b52f4c8aacfbc (diff) | |
download | git-sonar-637c573f7324538f27cd8a6869193e1364d75e76.tar.gz git-sonar-637c573f7324538f27cd8a6869193e1364d75e76.zip |
Revert "bash prompt length fix: zero-length chars must be placed between \[ and \]"
This reverts commit 0fe65ed830b5d1cdc5189230139b52f4c8aacfbc.
-rwxr-xr-x | git-radar | 32 | ||||
-rwxr-xr-x | prompt.bash | 8 | ||||
-rwxr-xr-x | radar-base.sh | 24 | ||||
-rwxr-xr-x | test-commits.sh | 6 |
4 files changed, 35 insertions, 35 deletions
@@ -13,22 +13,22 @@ fi dot="$(cd "$(dirname "$([ -L "$0" ] && $READLINK_CMD -f "$0" || echo "$0")")"; pwd)" if [[ -z $@ ]]; then - _git="\[\033[1;30m\]git:(\[\033[0m\]" - _master="\[\033[0;37m\]master\[\033[0m\]" - _my_branch="\[\033[0;37m\]my-branch\[\033[0m\]" - _endgit="\[\033[1;30m\])\[\033[0m\]" - _untracked="\[\033[1;37m\]A\[\033[0m\]" - _added_staged="\[\033[1;32m\]A\[\033[0m\]" - _modified_unstaged="\[\033[1;31m\]M\[\033[0m\]" - _local_up="\[\033[1;32m\]↑\[\033[0m\]" - _2_from_master="\xF0\x9D\x98\xAE 2 \[\033[1;31m\]→\[\033[0m\] " - _diverged_from_master="\xF0\x9D\x98\xAE 2 \[\033[1;33m\]⇄\[\033[0m\] 3 " - _not_upstream="upstream \[\033[1;31m\]⚡\[\033[0m\] " - _detached="\[\033[0;37m\]detached@94eac67\[\033[0m\]" - _conflicted_us="\[\033[1;33m\]U\[\033[0m\]" - _conflicted_them="\[\033[1;33m\]T\[\033[0m\]" - _ahead_master="\xF0\x9D\x98\xAE \[\033[1;32m\]←\[\033[0m\]" - _local_diverged="\[\033[1;33m\]⇵\[\033[0m\]" + _git="\033[1;30mgit:(\033[0m" + _master="\033[0;37mmaster\033[0m" + _my_branch="\033[0;37mmy-branch\033[0m" + _endgit="\033[1;30m)\033[0m" + _untracked="\033[1;37mA\033[0m" + _added_staged="\033[1;32mA\033[0m" + _modified_unstaged="\033[1;31mM\033[0m" + _local_up="\033[1;32m↑\033[0m" + _2_from_master="\xF0\x9D\x98\xAE 2 \033[1;31m→\033[0m " + _diverged_from_master="\xF0\x9D\x98\xAE 2 \033[1;33m⇄\033[0m 3 " + _not_upstream="upstream \033[1;31m⚡\033[0m " + _detached="\033[0;37mdetached@94eac67\033[0m" + _conflicted_us="\033[1;33mU\033[0m" + _conflicted_them="\033[1;33mT\033[0m" + _ahead_master="\xF0\x9D\x98\xAE \033[1;32m←\033[0m" + _local_diverged="\033[1;33m⇵\033[0m" echo "git-radar - a heads up display for git" echo "" echo "examples:" diff --git a/prompt.bash b/prompt.bash index 4ceaf22..d577087 100755 --- a/prompt.bash +++ b/prompt.bash @@ -4,12 +4,12 @@ dot="$(cd "$(dirname "$0")"; pwd)" source "$dot/radar-base.sh" if is_repo; then - printf " \[\033[1;30m\]git:(\[\033[0m\]" + printf " \033[1;30mgit:(\033[0m" bash_color_remote_commits - printf "\[\033[0;37m\]" + printf "\033[0;37m" readable_branch_name - printf "\[\033[0m\]" + printf "\033[0m" bash_color_local_commits - printf "\[\033[1;30m\])\[\033[0m\]" + printf "\033[1;30m)\033[0m" bash_color_changes_status fi diff --git a/radar-base.sh b/radar-base.sh index 63b2b98..787d7a5 100755 --- a/radar-base.sh +++ b/radar-base.sh @@ -305,11 +305,11 @@ bash_color_changes_status() { local changes="" if [[ -n "$porcelain" ]]; then - local green_staged_prefix="\[\033[1;32m\]" - local red_unstaged_prefix="\[\033[1;31m\]" - local yellow_conflicted_prefix="\[\033[1;33m\]" - local grey_untracked_prefix="\[\033[1;37m\]" - local reset_suffix="\[\033[0m\]" + local green_staged_prefix="\033[1;32m" + local red_unstaged_prefix="\033[1;31m" + local yellow_conflicted_prefix="\033[1;33m" + local grey_untracked_prefix="\033[1;37m" + local reset_suffix="\033[0m" local staged_changes="$(staged_status "$porcelain" "$green_staged_prefix" "$reset_suffix")" local unstaged_changes="$(unstaged_status "$porcelain" "$red_unstaged_prefix" "$reset_suffix")" @@ -377,9 +377,9 @@ zsh_color_changes_status() { bash_color_local_commits() { local separator="${1:- }" - local green_ahead_arrow="\[\033[1;32m\]↑\[\033[0m\]" - local red_behind_arrow="\[\033[1;31m\]↓\[\033[0m\]" - local yellow_diverged_arrow="\[\033[1;33m\]⇵\[\033[0m\]" + local green_ahead_arrow="\033[1;32m↑\033[0m" + local red_behind_arrow="\033[1;31m↓\033[0m" + local yellow_diverged_arrow="\033[1;33m⇵\033[0m" local local_commits="" if remote_branch="$(remote_branch_name)"; then @@ -422,10 +422,10 @@ zsh_color_local_commits() { bash_color_remote_commits() { local remote_master="\xF0\x9D\x98\xAE" # an italic m to represent master - local green_ahead_arrow="\[\033[1;32m\]←\[\033[0m\]" - local red_behind_arrow="\[\033[1;31m\]→\[\033[0m\]" - local yellow_diverged_arrow="\[\033[1;33m\]⇄\[\033[0m\]" - local not_upstream="\[\033[1;31m\]⚡\[\033[0m\]" + local green_ahead_arrow="\033[1;32m←\033[0m" + local red_behind_arrow="\033[1;31m→\033[0m" + local yellow_diverged_arrow="\033[1;33m⇄\033[0m" + local not_upstream="\033[1;31m⚡\033[0m" if remote_branch="$(remote_branch_name)"; then remote_ahead="$(remote_ahead_of_master "$remote_branch")" diff --git a/test-commits.sh b/test-commits.sh index fda4ae3..0cca0e5 100755 --- a/test-commits.sh +++ b/test-commits.sh @@ -374,9 +374,9 @@ test_zsh_and_bash_local_commits() { local zsh_both="%{[yellow]%}⇵%{%}" local zsh_down="%{[red]%}↓%{%}" - printf -v bash_up "\[\033[1;32m\]↑\[\033[0m\]" - printf -v bash_both "\[\033[1;33m\]⇵\[\033[0m\]" - printf -v bash_down "\[\033[1;31m\]↓\[\033[0m\]" + printf -v bash_up "\033[1;32m↑\033[0m" + printf -v bash_both "\033[1;33m⇵\033[0m" + printf -v bash_down "\033[1;31m↓\033[0m" cd_to_tmp "remote" |