Repository navigation
Closed
Labels
bugSomething that's not working as intended
Milestone
Description
I am using a slightly modified version of hydro, which updates the git branch and ahead/behind in the background using a universal variable and --on-variable function to repaint the command line.
After d3ceba1, the prompt does not always repaint properly (8860fceeae0cd65ed5a90e8cb28324634aec03e2 is a revert of d3ceba1 on master):
A simple reproducer (works well with a repo that frequently rebases such as linux-next):
$ cat $HOME/.config/fish/conf.d/prompt.fish
if status is-interactive
set --global _hydro_git _hydro_git_$fish_pid
function $_hydro_git --on-variable $_hydro_git
commandline --function repaint
end
function _hydro_prompt --on-event fish_prompt
fish --private --command "
! command git --no-optional-locks rev-parse 2>/dev/null && set $_hydro_git && exit
command git rev-list --count --left-right @{upstream}...@ 2>/dev/null | read behind ahead
switch \"\$behind \$ahead\"
case \" \" \"0 0\"
case \"0 *\"
set upstream \" \$ahead\"
case \"* 0\"
set upstream \" \$behind\"
case \*
set upstream \" \$ahead \$behind\"
end
set --universal $_hydro_git \"\$upstream \"
" &
end
end
$ cat $HOME/.config/fish/functions/fish_prompt.fish
function fish_prompt
echo
echo "$PWD$$_hydro_git"
echo '$ '
endThe 486 1701 in the recording should disappear after the git reset --hard origin/master but it does not. My bisect log in case it matters:
# bad: [d0593b9b2bcbe6ebe224ee8eeffb985087f64b1e] Release 3.3.0
# good: [0c2cbfc01f686f11d0015c36ba66e7144794f537] Release 3.2.2
git bisect start '3.3.0' '3.2.2'
# good: [2e9dab71a3432913cf6ac0422c3821601290895d] __fish_apropos: Don't overwrite $dir
git bisect good 2e9dab71a3432913cf6ac0422c3821601290895d
# bad: [99284049207b60abce4fa684335a2e93f973a811] Remove some static_asserts out of the common.h header
git bisect bad 99284049207b60abce4fa684335a2e93f973a811
# good: [6ab794562380f92a045c0e705e91d1de6ba1bbce] Mild refactoring of universal variables
git bisect good 6ab794562380f92a045c0e705e91d1de6ba1bbce
# good: [af84c352826ffe80cb8831531bb54c77da1e3663] docs: A bit more on autoloading
git bisect good af84c352826ffe80cb8831531bb54c77da1e3663
# bad: [e19ccc8a7a247a1df36c5388ba59b9c42922854b] CHANGELOG
git bisect bad e19ccc8a7a247a1df36c5388ba59b9c42922854b
# good: [60d75e9aa05aa9c155c155ed898d22bbab0a6644] Remove proc_create_event
git bisect good 60d75e9aa05aa9c155c155ed898d22bbab0a6644
# bad: [d3ceba107e88b6c6e1a0358ebcb30366aeef653f] Clear to eol before outputting line in multi-line prompt
git bisect bad d3ceba107e88b6c6e1a0358ebcb30366aeef653f
# good: [c0b33774ca07527f290d9af49c0784841034b24f] Update docs on detecting fish_private_mode
git bisect good c0b33774ca07527f290d9af49c0784841034b24f
# first bad commit: [d3ceba107e88b6c6e1a0358ebcb30366aeef653f] Clear to eol before outputting line in multi-line prompt
Metadata
Metadata
Assignees
Labels
bugSomething that's not working as intended
Activity
[-]d3ceba107e88b6c6e1a0358ebcb30366aeef653f causes issues with repainting multi-line prompt[/-][+]`d3ceba107e88b6c6e1a0358ebcb30366aeef653f` causes issues with repainting multi-line prompt[/+]faho commentedon Jul 24, 2021
I'm sorry, what am I supposed to see in your asciinema?
Also which terminal are you using? Have you tried a different one?
faho commentedon Jul 24, 2021
Ah, okay, so your git prompt shows the commit difference - that "ahead behind" thing.
You switch to a different branch and the display appears to not update or update wrongly. $_hydro_git_PID has updated, and the repaint runs, but if the prompt has shortened it does not overwrite the entirety of the previous prompt.
Yeah, that's indeed d3ceba1. And because that was a fix for a very very very very unusual prompt in some terminals, I'm just gonna revert it for now.
nathanchance commentedon Jul 24, 2021
Thank you very much for the quick fix!
CHANGELOG updates for 3.4.0