From 9870faa8beceb8807a79802cb6ff457e7a3bf956 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Wed, 3 Apr 2024 13:06:17 +0200 Subject: [PATCH] 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". --- .../functions/__fish_config_interactive.fish | 2 +- share/functions/fish_title.fish | 31 +++++++++---------- 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/share/functions/__fish_config_interactive.fish b/share/functions/__fish_config_interactive.fish index c00c7bd5b..e7f398c8b 100644 --- a/share/functions/__fish_config_interactive.fish +++ b/share/functions/__fish_config_interactive.fish @@ -232,7 +232,7 @@ end" >$__fish_config_dir/config.fish or test "$TERM_PROGRAM" = iTerm.app end 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 end printf \e\]7\;file://%s%s\a $hostname (string escape --style=url $PWD) diff --git a/share/functions/fish_title.fish b/share/functions/fish_title.fish index 81ebe1af3..d8da07cf1 100644 --- a/share/functions/fish_title.fish +++ b/share/functions/fish_title.fish @@ -1,21 +1,18 @@ function fish_title - # emacs' "term" is basically the only term that can't handle it. - if not set -q INSIDE_EMACS; or string match -vq '*,term:*' -- $INSIDE_EMACS - # If we're connected via ssh, we print the hostname. - set -l ssh - set -q SSH_TTY - and set ssh "["(prompt_hostname | string sub -l 10 | string collect)"]" - # An override for the current command is passed as the first parameter. - # This is used by `fg` to show the true process name, among others. - if set -q argv[1] - echo -- $ssh (string sub -l 20 -- $argv[1]) (prompt_pwd -d 1 -D 1) - else - # Don't print "fish" because it's redundant - set -l command (status current-command) - if test "$command" = fish - set command - end - echo -- $ssh (string sub -l 20 -- $command) (prompt_pwd -d 1 -D 1) + # If we're connected via ssh, we print the hostname. + set -l ssh + set -q SSH_TTY + and set ssh "["(prompt_hostname | string sub -l 10 | string collect)"]" + # An override for the current command is passed as the first parameter. + # This is used by `fg` to show the true process name, among others. + if set -q argv[1] + echo -- $ssh (string sub -l 20 -- $argv[1]) (prompt_pwd -d 1 -D 1) + else + # Don't print "fish" because it's redundant + set -l command (status current-command) + if test "$command" = fish + set command end + echo -- $ssh (string sub -l 20 -- $command) (prompt_pwd -d 1 -D 1) end end