Replies: 3 comments 6 replies
-
First of all: I think what you're trying to do is flawed because it would mean that the behavior of hyperlinks already on screen may change when the cwd changes, which would violate the Principle of least astonishment. The working directory is defined as a URL by the associated escape sequences. An application might set the CWD to be an FTP URL for example, or the hostname part of the Independent of whether trying to use the PWD in the click handler is a good idea or not: what I think would be good is to adjust the lua API to either return a URL object that in turn provides accessor properties to extract different portions of the URL, such as the file/path portion, or to provide a helper function that will parse a url and return such a helper object. The latter approach has no backwards compatibility concerns, so that is what I would suggest doing first. |
Beta Was this translation helpful? Give feedback.
-
re: |
Beta Was this translation helpful? Give feedback.
-
re: Url type and escaping, please see: |
Beta Was this translation helpful? Give feedback.
-
Problem
I want handle
package.json:5:10
using VS Code, but find it hard to get current working dir onopen-uri
event handler.https://code.visualstudio.com/docs/editor/command-line#_opening-vs-code-with-urls
Currently, I have to do tricks with
wezterm.hostname()
sincepane:get_current_working_dir()
return URI, while I just need current working dir without hostname andfile:
protocol.Side question:
Why does
wezterm.open_with(uri:gsub("$PWD", cwd))
doesn't works? Why do I need to reassignuri
?Suggestion 1: Add
pane:get_current_working_dir_raw()
Or
pane:get_current_working_dir_path()
.Initially I was thinking about using
os.getenv("PWD")
,but I feel like creating a new cross-platform
pane
method would be better.I would need help on how
current_dir
works.Doing quick search, I found this, but not sure where should I work on:
wezterm/term/src/terminalstate/mod.rs
Line 353 in 2516afa
Suggestion 2: Add
$PWD
keywords onhyperlink_rules.format
Doesn't need to be
$PWD
.Kinda feel like
*magic*
,but simpler without modifying
open-uri
handler.Same. Unsure where I should work on. Maybe here?
wezterm/termwiz/src/hyperlink.rs
Line 253 in 2516afa
Thoughts? Thanks.
Beta Was this translation helpful? Give feedback.
All reactions