You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bash vi history search redraws the prompt incorrectly after the prompt length increases. #2252
I confirm this is a reproducible bug, not a feature request, idea, question, contribution proposal, or direction check.
I reproduced this bug on the version and environment reported below using the exact steps provided.
Current behavior
With set -o vi enabled, after changing into a directory that makes PS1 longer (/w), pressing Esc then / to perform a history search redraws the prompt incorrectly. The prompt is truncated, and the search text begins at the wrong position. Pressing Ctrl-L immediately redraws the prompt correctly.
Expected behavior
The full current prompt is displayed and the search text appears immediately after it.
Reproduction
Start Herdr while in $HOME.
Run:
bash --noprofile --norc
set -o vi
PS1='\u@\h:\w$ '
cd into a directory with a much longer path.
Press Esc, then /.
Begin typing a history search.
Impact
The prompt is corrupted and matches render illegibly at the right side of the screen.
I couldn't reproduce this on an Apple Silicon Mac using the official Herdr 0.7.5 binary, Bash 5.3.15, and Terminal.app. I tested at both 80 and 120 columns with the exact steps above; the full prompt and /cd remained correctly positioned. Herdr 0.8.0 behaved correctly too.
The only environment mismatch was macOS 26.5.2 versus 26.6. Could you share your Terminal window dimensions and a short screen recording of the corruption?
Thanks, the Herdr recording clearly shows the redraw. I noticed it uses your configured prompt with $(pathN 2), rather than the minimal prompt in the report, and the Herdr and Terminal.app windows have different dimensions.
Could you confirm whether it reproduces with the exact minimal setup below?
bash --noprofile --norc
set -o vi
PS1='\u@\h:\w\$ 'printf'TERM=%s\n'"$TERM"
stty size
Please include the TERM and stty size output from both Herdr and Terminal.app at matching dimensions. If it only occurs with your configured prompt, please also share:
This is a pernicious little scenario. If I set PS1 either to the minimal or my own from within herdr (interactively as shown) it does not seem to cause the problem - my apologies, I tried to get an easy to reproduce scenario and apparently botched something. There must be a more variables at play...
FOUND IT!! I was setting PS1 to the minimal value in ~/.bashrc, but I found code later that appears to be the source of the problem:
# If this is an xterm set the title to ***@***.***:dir
case "$TERM" in
xterm*|rxvt*)
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
;;
*)
;;
esac
Now the problem happens consistently in a new tab - BUT it only seems to occur if I start the new tab in a longer directory. From what I can tell, the new tab picks up the cwd of the active tab at the time I open it regardless of whether I use the mouse or prefix-c.
Steps to consistently reproduce problems:
$ cat ~/.bashrc
PS1='\u@\h:\w\$ '
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
$ pwd
/private/var/HoB_Secured/HoB-VCS/GitLab/data-gathering/oracle-features
{prefix-c}
# problem occurs in the new tab
For completeness, here's what we ended up with when problems occur:
$ declare -p PS1
declare -x PS1="\\[\\e]0;\\u@\\h: \\w\\a\\]\\u@\\h:\\w\\\$ "
# Not used to produce the problem, but FYI - there is probably an easier way...
$ declare -f pathN
pathN ()
{
n="${1:-2}";
echo $PWD | awk -F / -v OFS=/ '{ print $(NF-1), $NF }'
}
MICHAEL STONE
Principal/Cloud Architect | Opscompass | House of Brick
www.opscompass.com<http://www.opscompass.com/> | www.houseofbrick.com<http://www.houseofbrick.com/>
***@***.***?anonymous&ismsaljsauthenabled&ep=bwmEmailSignature>
Book time to meet with ***@***.***?anonymous&ismsaljsauthenabled&ep=bwmEmailSignature>
________________________________
From: Can Celik ***@***.***>
Sent: Tuesday, August 4, 2026 20:24
To: herdrdev/herdr ***@***.***>
Cc: Michael Stone ***@***.***>; Author ***@***.***>
Subject: Re: [herdrdev/herdr] Bash vi history search redraws the prompt incorrectly after the prompt length increases. (Issue #2252)
[https://avatars.githubusercontent.com/u/7064011?s=20&v=4]ogulcancelik left a comment (herdrdev/herdr#2252)<#2252 (comment)>
Thanks, the Herdr recording clearly shows the redraw. I noticed it uses your configured prompt with $(pathN 2), rather than the minimal prompt in the report, and the Herdr and Terminal.app windows have different dimensions.
Could you confirm whether it reproduces with the exact minimal setup below?
bash --noprofile --norc
set -o vi
PS1='\u@\h:\w\$ '
printf 'TERM=%s\n' "$TERM"
stty size
Please include the TERM and stty size output from both Herdr and Terminal.app at matching dimensions. If it only occurs with your configured prompt, please also share:
declare -p PS1
declare -f pathN
—
Reply to this email directly, view it on GitHub<#2252?email_source=notifications&email_token=A3FEO2H6ENKP7QULHKTAMO35IKLGFA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKMJYGY4DCMJTGM2KM4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KYZTPN52GK4S7MNWGSY3L#issuecomment-5186811334>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/A3FEO2H7UUXG6GL5PBJTCQT5IKLGFAVCNFSNUABGKJSXA33TNF2G64TZHMYTCOJTHEYDSMBVGA5US43TOVSTWNJQGU2DSOBWGA4TBILWAI>.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS<https://github.com/notifications/mobile/ios/A3FEO2HPXV2QSKEEBG2L7OD5IKLGFA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKMJYGY4DCMJTGM2KM4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KUZTPN52GK4S7NFXXG> and Android<https://github.com/notifications/mobile/android/A3FEO2EWMENX7TLTKVV2MY35IKLGFA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKMJYGY4DCMJTGM2KM4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2K4ZTPN52GK4S7MFXGI4TPNFSA>. Download it today!
You are receiving this because you authored the thread.Message ID: ***@***.***>
The contents of this email message and any attachments are intended solely for the addressee(s) and may contain confidential and/or privileged information and may be legally protected from disclosure. If you are not the intended recipient of this message or their agent, or if this message has been addressed to you in error, please immediately alert the sender by reply email and then delete this message and any attachments. If you are not the intended recipient, you are hereby notified that any use, dissemination, copying, or storage of this message or its attachments is strictly prohibited.
hey, we're cleaning up issues from before 0.9. a lot changed since then and some of these may already be fixed or behave differently now, so i'm closing older reports that haven't had activity since 0.9.0 shipped.
if this still happens for you on the latest version, please open a new issue with the template so we can triage it against the current version. thanks for reporting it.
Activity
ogulcancelik commentedon Aug 3, 2026
I couldn't reproduce this on an Apple Silicon Mac using the official Herdr 0.7.5 binary, Bash 5.3.15, and Terminal.app. I tested at both 80 and 120 columns with the exact steps above; the full prompt and
/cdremained correctly positioned. Herdr 0.8.0 behaved correctly too.The only environment mismatch was macOS 26.5.2 versus 26.6. Could you share your Terminal window dimensions and a short screen recording of the corruption?
ocmstone commentedon Aug 5, 2026
Thanks for looking into this! Adding examples in herdr and in terminal.app showing the problem occurs in herder only.
herdr:
https://github.com/user-attachments/assets/033778e9-dcb1-42b9-9261-9f237c7a4eae
Terminal.app:
https://github.com/user-attachments/assets/92d22900-dd7c-41de-9d84-825c099c563e
ogulcancelik commentedon Aug 5, 2026
Thanks, the Herdr recording clearly shows the redraw. I noticed it uses your configured prompt with
$(pathN 2), rather than the minimal prompt in the report, and the Herdr and Terminal.app windows have different dimensions.Could you confirm whether it reproduces with the exact minimal setup below?
Please include the
TERMandstty sizeoutput from both Herdr and Terminal.app at matching dimensions. If it only occurs with your configured prompt, please also share:ocmstone commentedon Aug 5, 2026
ogulcancelik commentedon Oct 1, 2026
hey, we're cleaning up issues from before 0.9. a lot changed since then and some of these may already be fixed or behave differently now, so i'm closing older reports that haven't had activity since 0.9.0 shipped.
if this still happens for you on the latest version, please open a new issue with the template so we can triage it against the current version. thanks for reporting it.