mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-29 06:13:20 +00:00
Add $fish_handle_reflow to disable winch handler
Overriding event handlers is annoying.
This commit is contained in:
parent
48082daad4
commit
e192066e98
2 changed files with 22 additions and 13 deletions
|
@ -1249,6 +1249,8 @@ You can change the settings of fish by changing the values of certain variables.
|
||||||
|
|
||||||
- ``fish_greeting``, the greeting message printed on startup. This is printed by a function of the same name that can be overridden for more complicated changes (see :ref:`funced <cmd-funced>`
|
- ``fish_greeting``, the greeting message printed on startup. This is printed by a function of the same name that can be overridden for more complicated changes (see :ref:`funced <cmd-funced>`
|
||||||
|
|
||||||
|
- ``fish_handle_reflow``, determines whether fish should try to repaint the commandline when the terminal resizes. In terminals that reflow text this should be disabled. Set it to 1 to enable, anything else to disable.
|
||||||
|
|
||||||
- ``fish_history``, the current history session name. If set, all subsequent commands within an
|
- ``fish_history``, the current history session name. If set, all subsequent commands within an
|
||||||
interactive fish session will be logged to a separate file identified by the value of the
|
interactive fish session will be logged to a separate file identified by the value of the
|
||||||
variable. If unset, or set to ``default``, the default session name "fish" is used. If set to an
|
variable. If unset, or set to ``default``, the default session name "fish" is used. If set to an
|
||||||
|
|
|
@ -241,24 +241,31 @@ function __fish_config_interactive -d "Initializations that should be performed
|
||||||
# __fish_enable_focus
|
# __fish_enable_focus
|
||||||
end
|
end
|
||||||
|
|
||||||
function __fish_winch_handler --on-signal WINCH -d "Repaint screen when window changes size"
|
# Detect whether the terminal reflows on its own
|
||||||
|
# If it does we shouldn't do it.
|
||||||
|
# Allow $fish_handle_reflow to override it.
|
||||||
|
if not set -q fish_handle_reflow
|
||||||
# VTE reflows the text itself, so us doing it inevitably races against it.
|
# VTE reflows the text itself, so us doing it inevitably races against it.
|
||||||
# Guidance from the VTE developers is to let them repaint.
|
# Guidance from the VTE developers is to let them repaint.
|
||||||
if set -q VTE_VERSION
|
if set -q VTE_VERSION
|
||||||
return
|
# Same for alacritty
|
||||||
end
|
or string match -q -- 'alacritty*' $TERM
|
||||||
# Same for alacritty
|
set -g fish_handle_reflow 0
|
||||||
if string match -q -- 'alacritty*' $TERM
|
else if set -q KONSOLE_VERSION
|
||||||
return
|
|
||||||
end
|
|
||||||
# Konsole since version 21.04(.00)
|
|
||||||
# Note that this is optional, but since we have no way of detecting it
|
|
||||||
# we go with the default, which is true.
|
|
||||||
if set -q KONSOLE_VERSION
|
|
||||||
and test "$KONSOLE_VERSION" -ge 210400 2>/dev/null
|
and test "$KONSOLE_VERSION" -ge 210400 2>/dev/null
|
||||||
return
|
# Konsole since version 21.04(.00)
|
||||||
|
# Note that this is optional, but since we have no way of detecting it
|
||||||
|
# we go with the default, which is true.
|
||||||
|
set -g fish_handle_reflow 0
|
||||||
|
else
|
||||||
|
set -g fish_handle_reflow 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function __fish_winch_handler --on-signal WINCH -d "Repaint screen when window changes size"
|
||||||
|
if test "$fish_handle_reflow" = 1 2>/dev/null
|
||||||
|
commandline -f repaint >/dev/null 2>/dev/null
|
||||||
end
|
end
|
||||||
commandline -f repaint >/dev/null 2>/dev/null
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Notify terminals when $PWD changes (issue #906).
|
# Notify terminals when $PWD changes (issue #906).
|
||||||
|
|
Loading…
Reference in a new issue