From 130fb456fbb2d9b73fc18404d2341583227be516 Mon Sep 17 00:00:00 2001 From: dusoleil Date: Wed, 4 Aug 2021 19:18:11 -0400 Subject: Add Control Characters back to Color Config to Fix Line Wrapping "\001" (Start of Heading) and "\002" (Start of Text) control characters were mistakenly removed from the color config part of the main script. Some shells (e.g. bash) struggle with line wrapping issues without these. Bash needs them to calculate which characters are printable and which aren't for figuring out where to linewrap. This patch just adds them back in. Signed-off-by: dusoleil Signed-off-by: Malfurious --- git-sonar | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/git-sonar b/git-sonar index d00045a..1b9ee03 100755 --- a/git-sonar +++ b/git-sonar @@ -45,32 +45,33 @@ prepare_colors() { PRINT_F_OPTION="" - COLOR_REMOTE_AHEAD="${GIT_RADAR_COLOR_REMOTE_AHEAD:-"\\033[1;32m"}" - COLOR_REMOTE_BEHIND="${GIT_RADAR_COLOR_REMOTE_BEHIND:-"\\033[1;31m"}" - COLOR_REMOTE_DIVERGED="${GIT_RADAR_COLOR_REMOTE_DIVERGED:-"\\033[1;33m"}" - COLOR_REMOTE_NOT_UPSTREAM="${GIT_RADAR_COLOR_REMOTE_NOT_UPSTREAM:-"\\033[1;31m"}" + COLOR_REMOTE_AHEAD="\x01${GIT_RADAR_COLOR_REMOTE_AHEAD:-"\\033[1;32m"}\x02" + COLOR_REMOTE_BEHIND="\x01${GIT_RADAR_COLOR_REMOTE_BEHIND:-"\\033[1;31m"}\x02" + COLOR_REMOTE_DIVERGED="\x01${GIT_RADAR_COLOR_REMOTE_DIVERGED:-"\\033[1;33m"}\x02" + COLOR_REMOTE_NOT_UPSTREAM="\x01${GIT_RADAR_COLOR_REMOTE_NOT_UPSTREAM:-"\\033[1;31m"}\x02" - COLOR_LOCAL_AHEAD="${GIT_RADAR_COLOR_LOCAL_AHEAD:-"\\033[1;32m"}" - COLOR_LOCAL_BEHIND="${GIT_RADAR_COLOR_LOCAL_BEHIND:-"\\033[1;31m"}" - COLOR_LOCAL_DIVERGED="${GIT_RADAR_COLOR_LOCAL_DIVERGED:-"\\033[1;33m"}" + COLOR_LOCAL_AHEAD="\x01${GIT_RADAR_COLOR_LOCAL_AHEAD:-"\\033[1;32m"}\x02" + COLOR_LOCAL_BEHIND="\x01${GIT_RADAR_COLOR_LOCAL_BEHIND:-"\\033[1;31m"}\x02" + COLOR_LOCAL_DIVERGED="\x01${GIT_RADAR_COLOR_LOCAL_DIVERGED:-"\\033[1;33m"}\x02" - COLOR_CHANGES_STAGED="${GIT_RADAR_COLOR_CHANGES_STAGED:-"\\033[1;32m"}" - COLOR_CHANGES_UNSTAGED="${GIT_RADAR_COLOR_CHANGES_UNSTAGED:-"\\033[1;31m"}" - COLOR_CHANGES_CONFLICTED="${GIT_RADAR_COLOR_CHANGES_CONFLICTED:-"\\033[1;33m"}" - COLOR_CHANGES_UNTRACKED="${GIT_RADAR_COLOR_CHANGES_UNTRACKED:-"\\033[1;37m"}" + COLOR_CHANGES_STAGED="\x01${GIT_RADAR_COLOR_CHANGES_STAGED:-"\\033[1;32m"}\x02" + COLOR_CHANGES_UNSTAGED="\x01${GIT_RADAR_COLOR_CHANGES_UNSTAGED:-"\\033[1;31m"}\x02" + COLOR_CHANGES_CONFLICTED="\x01${GIT_RADAR_COLOR_CHANGES_CONFLICTED:-"\\033[1;33m"}\x02" + COLOR_CHANGES_UNTRACKED="\x01${GIT_RADAR_COLOR_CHANGES_UNTRACKED:-"\\033[1;37m"}\x02" - COLOR_STASH="${GIT_RADAR_COLOR_STASH:-"\\033[1;33m"}" + COLOR_STASH="\x01${GIT_RADAR_COLOR_STASH:-"\\033[1;33m"}\x02" - COLOR_BRANCH="${GIT_RADAR_COLOR_BRANCH:-"\\033[0m"}" + COLOR_BRANCH="\x01${GIT_RADAR_COLOR_BRANCH:-"\\033[0m"}\x02" MASTER_SYMBOL="${GIT_RADAR_MASTER_SYMBOL:-"\\x01\\033[0m\\x02\\xF0\\x9D\\x98\\xAE\\x01\\033[0m\\x02"}" PROMPT_FORMAT="${GIT_RADAR_FORMAT:-" \\x01\\033[1;30m\\x02git:(\\x01\\033[0m\\x02%{remote: }%{branch}%{ :local}\\x01\\033[1;30m\\x02)\\x01\\033[0m\\x02%{ :stash}%{ :changes}"}" - RESET_COLOR_LOCAL="${GIT_RADAR_COLOR_LOCAL_RESET:-"\\033[0m"}" - RESET_COLOR_REMOTE="${GIT_RADAR_COLOR_REMOTE_RESET:-"\\033[0m"}" - RESET_COLOR_CHANGES="${GIT_RADAR_COLOR_CHANGES_RESET:-"\\033[0m"}" - RESET_COLOR_BRANCH="${GIT_RADAR_COLOR_BRANCH_RESET:-"\\033[0m"}" - RESET_COLOR_STASH="${GIT_RADAR_COLOR_STASH:-"\\033[0m"}" + RESET_COLOR_LOCAL="\x01${GIT_RADAR_COLOR_LOCAL_RESET:-"\\033[0m"}\x02" + RESET_COLOR_REMOTE="\x01${GIT_RADAR_COLOR_REMOTE_RESET:-"\\033[0m"}\x02" + RESET_COLOR_CHANGES="\x01${GIT_RADAR_COLOR_CHANGES_RESET:-"\\033[0m"}\x02" + RESET_COLOR_BRANCH="\x01${GIT_RADAR_COLOR_BRANCH_RESET:-"\\033[0m"}\x02" + RESET_COLOR_STASH="\x01${GIT_RADAR_COLOR_STASH:-"\\033[0m"}\x02" + } in_current_dir() { -- cgit v1.2.3