elvish: use kitty-shell-cwd:// to report pwd

OSC 7's standard body is a percent-encoded file:// URL. There isn't an
easy way for us to percent-encode the path ($pwd) component here without
implementing a custom function.

Instead, switch to the kitty-shell-cwd:// scheme, which Kitty introduced
to ease this implementation challenge in shell scripts. It accepts the
path string verbatim, without an encoding.

In Ghostty, we accept both the file:// and kitty-shell-cwd:// schemes,
and we attempt to URI-decode them both, so in practice this is more
about the "correctness" of this protocol than a functional change. It's
also possible we might decide to treat these schemes differently in the
runtime, like Kitty does.
This commit is contained in:
Jon Parise
2025-04-08 10:38:57 -04:00
parent 17ba0252e8
commit b213c157f0

View File

@@ -76,7 +76,7 @@
fn report-pwd {
use platform
printf "\e]7;file://%s%s\a" platform:hostname $pwd
printf "\e]7;kitty-shell-cwd://%s%s\a" platform:hostname $pwd
}
fn sudo-with-terminfo {|@args|