mirror of
https://github.com/starship/starship.git
synced 2024-11-22 00:04:05 +01:00
fix(fish): improve fish transient prompt (#6107)
* feat(fish): improve fish transient prompt * feat(fish): improve fish transient prompt
This commit is contained in:
parent
e629ea1c7a
commit
274dff37db
@ -11,6 +11,7 @@ function fish_prompt
|
||||
set STARSHIP_DURATION "$CMD_DURATION$cmd_duration"
|
||||
set STARSHIP_JOBS (count (jobs -p))
|
||||
if test "$TRANSIENT" = "1"
|
||||
set -g TRANSIENT 0
|
||||
# Clear from cursor to end of screen as `commandline -f repaint` does not do this
|
||||
# See https://github.com/fish-shell/fish-shell/issues/8418
|
||||
printf \e\[0J
|
||||
@ -36,7 +37,8 @@ function fish_right_prompt
|
||||
# Account for changes in variable name between v2.7 and v3.0
|
||||
set STARSHIP_DURATION "$CMD_DURATION$cmd_duration"
|
||||
set STARSHIP_JOBS (count (jobs -p))
|
||||
if test "$TRANSIENT" = "1"
|
||||
if test "$RIGHT_TRANSIENT" = "1"
|
||||
set -g RIGHT_TRANSIENT 0
|
||||
if type -q starship_transient_rprompt_func
|
||||
starship_transient_rprompt_func
|
||||
else
|
||||
@ -58,14 +60,19 @@ set -gx STARSHIP_SHELL "fish"
|
||||
# Transience related functions
|
||||
function reset-transient --on-event fish_postexec
|
||||
set -g TRANSIENT 0
|
||||
set -g RIGHT_TRANSIENT 0
|
||||
end
|
||||
|
||||
function transient_execute
|
||||
if commandline --is-valid
|
||||
if commandline --paging-mode
|
||||
commandline -f accept-autosuggestion
|
||||
return
|
||||
end
|
||||
commandline --is-valid
|
||||
if test $status != 2
|
||||
set -g TRANSIENT 1
|
||||
set -g RIGHT_TRANSIENT 1
|
||||
commandline -f repaint
|
||||
else
|
||||
set -g TRANSIENT 0
|
||||
end
|
||||
commandline -f execute
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user