Prevent seperate fish instances from interfering with each other

This commit is contained in:
Ilan Cosman 2020-11-24 19:30:59 -08:00
parent c794140008
commit 09784a9a02
2 changed files with 12 additions and 5 deletions

View File

@ -35,11 +35,11 @@ function _tide_right_prompt
end
if test $printAtEndedRightPromptHeight -eq $_tide_left_prompt_height
set -U _tide_right_prompt_display $splitText[-1]
set -U _tide_right_prompt_display_$_tide_fish_pid $splitText[-1]
set printAtEndedRightPromptHeight (math $printAtEndedRightPromptHeight-1)
else
_tide_print_at_end $splitText[-1]
set -U _tide_right_prompt_display
set -U _tide_right_prompt_display_$_tide_fish_pid
end
_tide_cursor_up $printAtEndedRightPromptHeight

View File

@ -1,16 +1,23 @@
function fish_prompt --description 'Created by tide configure'
set -lx _tide_last_pipestatus $pipestatus
set -lx _tide_last_status $status
set -lx _tide_fish_pid $fish_pid # User for right prompt
set -lx COLUMNS $COLUMNS
set -q SSH_TTY && set -lx SSH_TTY $SSH_TTY
set -lx _tide_cmd_duration $CMD_DURATION
fish --command 'set -U _tide_left_prompt_display (_tide_prompt)' &
fish --command "set -U _tide_left_prompt_display_$fish_pid (_tide_prompt)" &
string unescape $_tide_left_prompt_display
set -l displayVarName _tide_left_prompt_display_$fish_pid
string unescape $$displayVarName
end
function _tide_refresh_prompt --on-variable _tide_left_prompt_display --on-variable _tide_right_prompt_display
function _tide_refresh_prompt --on-variable _tide_left_prompt_display_$fish_pid
commandline --function repaint
end
function _tide_on_fish_exit --on-even fish_exit
set -e _tide_left_prompt_display_$fish_pid
set -e _tide_right_prompt_display_$fish_pid
end