Skip to content

Fish OSC 7 reporting is suboptimal #12191

@CGamesPlay

Description

@CGamesPlay

In __fish_config_interactive, there is a hook to "Notify terminals when $PWD changes via OSC 7 (issue #906)."

The implementation monitors $PWD to send this information, rather than emitting it on every prompt. I'm not sure what the initial rationale for that is, it seems like it's just always been that way. However, it has a few drawbacks:

  • Some programs update this during their normal execution to update the window title, and
  • It doesn't properly update when exiting an SSH session

I propose moving this code to be part of the fish prompt so that it is always up-to-date.

Also, iTerm supports this feature, so I originally wanted to make this PR:

diff --git i/share/functions/__fish_config_interactive.fish w/share/functions/__fish_config_interactive.fish
index 1674cc4a0..ea34940e1 100644
--- i/share/functions/__fish_config_interactive.fish
+++ w/share/functions/__fish_config_interactive.fish
@@ -151,7 +151,7 @@ end" >$__fish_config_dir/config.fish
             if set -q KONSOLE_VERSION
                 set host ''
             end
-            if [ -n "$MSYSTEM" ] && string match -rq -- '^(Konsole|WezTerm) ' (status terminal)
+            if [ -n "$MSYSTEM" ] && string match -rq -- '^(Konsole|WezTerm|iTerm2) ' (status terminal)
                 return
             end
             if [ "$TERM" = dumb ]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions