mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-14 14:01:16 -03:00
Commit 7996637db5 (Make fish immediately show color changes again,
2025-12-01) repaints unnecessarily when a local unexported color
variable changes. Also, it repaints when the change comes from
fish_prompt, causing an easy infinite loop. Same when changing TERM,
COLORTERM and others.
This feature is relevant when using a color-theme aware theme, so
try to keep it. Repaint only on global/universal changes.
Also ignore changes if already repainting fish prompt.
This change may be at odds with concurrent execution (parser should
not care about whether we are repainting) but that's intentional
because of 1. time constraints and 2. I'm not sure what the solution
will look like; we could use the event infrastructure. But a lot of
existing variable listeners don't use that.
Extract a context object we pass whenever we mutate the environment; While
at it, use it to pass EnvMode::USER, to reduce EnvMode responsibilities.
Fixes #12233
50 lines
1.3 KiB
Fish
50 lines
1.3 KiB
Fish
#RUN: %fish %s
|
|
#REQUIRES: command -v tmux
|
|
|
|
isolated-tmux-start -C '
|
|
function fish_prompt
|
|
set -g counter (math $counter + 1)
|
|
set -g fish_color_status red
|
|
set -g fish_pager_color_background --background=white
|
|
echo "$counter> "
|
|
set -ga TERM .
|
|
set -ga TERMINFO .
|
|
set -ga TERMINFO_DIRS .
|
|
set -ga COLORTERM .
|
|
set -ga fish_term256 .
|
|
set -ga fish_term24bit .
|
|
end
|
|
set -eg fish_color_param
|
|
bind ctrl-g,A "{ set -l fish_color_command 111 }"
|
|
bind ctrl-g,B "set -l fish_color_command 222"
|
|
bind ctrl-g,C "set -e fish_color_command"
|
|
bind ctrl-g,D "set -eg fish_color_param"
|
|
bind ctrl-g,E "set -g fish_color_command 333"
|
|
bind ctrl-g,F "set -U fish_color_param 444"
|
|
bind ctrl-g,G "set -eg fish_color_command"
|
|
'
|
|
|
|
isolated-tmux capture-pane -p
|
|
# The weird global assignments in fish prompt cause an initial repaint.
|
|
# CHECK: 2>
|
|
|
|
isolated-tmux send-keys C-g A C-g B C-g C C-g D
|
|
tmux-sleep
|
|
isolated-tmux capture-pane -p
|
|
# CHECK: 2>
|
|
|
|
isolated-tmux send-keys C-g E
|
|
tmux-sleep
|
|
isolated-tmux capture-pane -p
|
|
# CHECK: 3>
|
|
|
|
isolated-tmux send-keys C-g F
|
|
tmux-sleep
|
|
isolated-tmux capture-pane -p
|
|
# CHECK: 4>
|
|
|
|
isolated-tmux send-keys C-g G
|
|
tmux-sleep
|
|
isolated-tmux capture-pane -p
|
|
# CHECK: 5>
|