All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Quadling <rquadling@gmail.com>
To: git@vger.kernel.org
Subject: Fix early wrapping when using bash with git-prompt.sh
Date: Mon, 11 Mar 2024 14:05:23 +0000	[thread overview]
Message-ID: <CAKUjMCXik2565fok+z9=43DUcigbfqpWAEM-rfnO0rN=gS-Okw@mail.gmail.com> (raw)

diff --git a/contrib/completion/git-prompt.sh b/contrib/completion/git-prompt.sh
index 71f179cba3..6585164efe 100644
--- a/contrib/completion/git-prompt.sh
+++ b/contrib/completion/git-prompt.sh
@@ -259,10 +259,10 @@ __git_ps1_colorize_gitstring ()
  else
  # Using \001 and \002 around colors is necessary to prevent
  # issues with command line editing/browsing/completion!
- local c_red=$'\001\e[31m\002'
- local c_green=$'\001\e[32m\002'
- local c_lblue=$'\001\e[1;34m\002'
- local c_clear=$'\001\e[0m\002'
+ local c_red=$'\\001\e[31m\\002'
+ local c_green=$'\\001\e[32m\\002'
+ local c_lblue=$'\\001\e[1;34m\\002'
+ local c_clear=$'\\001\e[0m\\002'
  fi
  local bad_color=$c_red
  local ok_color=$c_green
diff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh
index d667dda654..fc6fdd36c6 100755
--- a/t/t9903-bash-prompt.sh
+++ b/t/t9903-bash-prompt.sh
@@ -13,10 +13,10 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 . "$GIT_BUILD_DIR/contrib/completion/git-prompt.sh"

 actual="$TRASH_DIRECTORY/actual"
-c_red='\001\e[31m\002'
-c_green='\001\e[32m\002'
-c_lblue='\001\e[1;34m\002'
-c_clear='\001\e[0m\002'
+c_red='\\001\e[31m\\002'
+c_green='\\001\e[32m\\002'
+c_lblue='\\001\e[1;34m\\002'
+c_clear='\\001\e[0m\\002'

 test_expect_success 'setup for prompt tests' '
  git init otherrepo &&

                 reply	other threads:[~2024-03-11 14:05 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAKUjMCXik2565fok+z9=43DUcigbfqpWAEM-rfnO0rN=gS-Okw@mail.gmail.com' \
    --to=rquadling@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.