Remove workarounds for Emacs ansi-term

I'm not sure if it's worth supporting a terminal that mishandles unknown OSC
and CSI sequences. Better to fix the terminal.  Note that there are Emacs
terminals available that don't have this problems; for example "vterm".
This commit is contained in:
Johannes Altmanninger 2024-04-03 13:06:17 +02:00
parent af1b599818
commit 9870faa8be
2 changed files with 15 additions and 18 deletions

View File

@ -232,7 +232,7 @@ end" >$__fish_config_dir/config.fish
or test "$TERM_PROGRAM" = iTerm.app or test "$TERM_PROGRAM" = iTerm.app
end end
function __update_cwd_osc --on-variable PWD --description 'Notify capable terminals when $PWD changes' function __update_cwd_osc --on-variable PWD --description 'Notify capable terminals when $PWD changes'
if status --is-command-substitution || set -q INSIDE_EMACS if status --is-command-substitution
return return
end end
printf \e\]7\;file://%s%s\a $hostname (string escape --style=url $PWD) printf \e\]7\;file://%s%s\a $hostname (string escape --style=url $PWD)

View File

@ -1,21 +1,18 @@
function fish_title function fish_title
# emacs' "term" is basically the only term that can't handle it. # If we're connected via ssh, we print the hostname.
if not set -q INSIDE_EMACS; or string match -vq '*,term:*' -- $INSIDE_EMACS set -l ssh
# If we're connected via ssh, we print the hostname. set -q SSH_TTY
set -l ssh and set ssh "["(prompt_hostname | string sub -l 10 | string collect)"]"
set -q SSH_TTY # An override for the current command is passed as the first parameter.
and set ssh "["(prompt_hostname | string sub -l 10 | string collect)"]" # This is used by `fg` to show the true process name, among others.
# An override for the current command is passed as the first parameter. if set -q argv[1]
# This is used by `fg` to show the true process name, among others. echo -- $ssh (string sub -l 20 -- $argv[1]) (prompt_pwd -d 1 -D 1)
if set -q argv[1] else
echo -- $ssh (string sub -l 20 -- $argv[1]) (prompt_pwd -d 1 -D 1) # Don't print "fish" because it's redundant
else set -l command (status current-command)
# Don't print "fish" because it's redundant if test "$command" = fish
set -l command (status current-command) set command
if test "$command" = fish
set command
end
echo -- $ssh (string sub -l 20 -- $command) (prompt_pwd -d 1 -D 1)
end end
echo -- $ssh (string sub -l 20 -- $command) (prompt_pwd -d 1 -D 1)
end end
end end