nixos/foot: only modify the prompt when running inside foot
Without this, these integration scripts will mess with the prompt even when not running a shell inside of foot. This can break: 1. Terminals that don't understand these sequences (e.g., gnome-terminal and likely other vte based terminals). 2. Anything that tries to parse the prompt (Emacs packages like bash-completion). This patch relies on the TERM variable (against upstream's recommendation [1]) because: 1. Only Fish [2] has built-in support for querying things like XTVERSION. Querying terminal features manually is non-trivial and requires writing to STDOUT, which I'd like to avoid. 2. Even in Fish, this XTVERSION may only be queried after the first prompt has been displayed ([2]), which is too late. This patch does not explicitly check if the terminal is interactive as the modified files are only sourced by interactive shells anyway. [1]: https://codeberg.org/dnkl/foot#programmatically-checking-if-running-in-foot [2]: https://fishshell.com/docs/current/cmds/status.html#status-terminal fixes #374613
This commit is contained in:
@@ -1,3 +1,8 @@
|
||||
case "$TERM" in
|
||||
foot*) : ;;
|
||||
*) return 0 ;;
|
||||
esac
|
||||
|
||||
osc7_cwd() {
|
||||
local strlen=${#PWD}
|
||||
local encoded=""
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
if ! string match -q "foot*" "$TERM"
|
||||
return 0
|
||||
end
|
||||
|
||||
function update_cwd_osc --on-variable PWD --description 'Notify terminals when $PWD changes'
|
||||
if status --is-command-substitution || set -q INSIDE_EMACS
|
||||
return
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
case "$TERM" in
|
||||
foot*) : ;;
|
||||
*) return 0 ;;
|
||||
esac
|
||||
|
||||
function osc7-pwd() {
|
||||
emulate -L zsh # also sets localoptions for us
|
||||
setopt extendedglob
|
||||
|
||||
Reference in New Issue
Block a user