-
Notifications
You must be signed in to change notification settings - Fork 8.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scenario: Add support for hyperlinks #5001
Comments
Proposed order of attack:
|
Yeah i definitely think tooltip and “the link preview from the video” are different workitems that we should tackle separately :) |
If you have to have a "link preview", I'd recommend something really basic based on the page meta data (like the meta title and description, and maybe a favicon and/or og:image). But as cool as this might seem, I don't think it's practical for a hover effect given the delay needed to download and render these things (unless you're pre-rendering the previews, which sounds like a really bad idea). Which brings me to the main problem. Even if you're only connecting to the site on hover, that still seems inadvisable. When I'm using a terminal I really wouldn't expect it to be making internet connections without my consent. So this feature would definitely have to be optional, and arguably I think should be off by default. I'm possibly a little biased here, because my internet connection is metered to a certain extent. But even if that weren't the case, would most people be comfortable with their terminal downloading unknown webpages in the background? |
Yeah, I definitely don't think that "fetch any link I hover over" is something we should ship in core or opt-in by default. It makes for a really compelling video because it shows how modern and flashy we are, but it's too much of a disclosure and safety risk to put right into our project. |
Would this be RFC conforming 😒 |
Generally, "whatever type of thing is supported by the registered protocol handler" ;P |
I don't know whether this has been considered already, but when doing a rich-text copy of the terminal buffer the hyperlinks should probably be preserved on paste |
Thanks @jantari! Just added that to the main scenario body. |
I just built the latest commit, but it can't parse an url, you have to use the escape sequences. Is this use case planned: echo 'Hello from Windows Terminal: https://github.com/microsoft/terminal/' And then click on the link and it opens? |
to be fair, mailto isn’t traditionally followed by So that’s the plan. |
@vefatica, in v1.7.572.0, TerminalPage::_IsUriSupported allows only |
What about ftp://? ... not supported? Yet it gets underlined and a popup tip. I can't remember way back but in recent decades I've always used mailto://. ShellExecuteEx doesn't mind |
According to #7691 (comment),
|
|
Hi! I'd like to be able to configure the web browser used to open hyperlinks, but just for Windows Terminal (not OS-wide). I couldn't find an open issue about that, should I open a feature request ? :) Thanks for working on such a nice app! |
@phil-blain From #9491
|
@zadjii-msft |
@ironyman |
So yes and no. Apps can print hyperlinks, for sure, easily today with OSC8 as mentioned above. Now, there's definitely limitations here. The OSC8 spec specifically calls out files in this section, Then there's always the issue of updating the utilities to make use of that sequence. Updating the |
Thank you @lucy I didn't know that command existed. That addresses one issue! @zadjii-msft clickable sendInput is a really good idea. I imagine it would be very useful after say running Although what if you don't want to checkout but rather you want to delete the branch? Is there an easy way to give the user a list of options? |
@ironyman That's definitely an interesting idea. We're absolutely in the realm of hypotheticals now. Click-to-sendInput isn't an existing paradigm, so I suppose we can come up with whatever we want. What would that UX be like? Since I'm keeping notes here: clickable sendInput
|
I think the particular scenario you're discussing (suggesting branch names) is better served by tab-completion. But, for other scenarios or if mouse-interaction is really really wanted then console-apps can already receive and process mouse input (see INPUT_RECORD struct). I feel like it is best left to application developers to create either git-clients or tab-completion engines that implement mouse-support application-side. I don't think it is something the terminal needs to get (even more) involved in, unless there is a recognized VT standard for it we don't support but I haven't heard of any. |
Click-to-sendInput seems rather error-prone because the software that outputs the clickable text does not know which software will eventually read the input, or what else will already be in the input buffer. Alternatively, clicking the text could copy an application-specified string to the clipboard (or display a menu of such strings), and the user could then separately paste it where desired (respecting the bracketed paste mode). This would not allow the string to contain function-key events or similar. Alternatively, clicking the text could send a Windows Terminal specific event with an application-defined (Base64?) payload, and the receiving application could then decide whether to run it as a command or insert as text. This however would require changes in shells in order to handle such events. |
Looks similar to https://fig.io. I would love to see it on Windows |
I think tab completion is good for people that already know what commands they want to use but for beginners it would be helpful to have the relevant commands presented to them when the context appears. It's also more convenient to click on a menu item even if you could type it sometimes because it's faster. If you're familiar with windbg, it has a CLI environment where some commands output clickable text that executes commands in appropriate situations. Regarding your second point, I think it's hard to leave everything to app developer and the terminal has to help out here because in git, it will print something and exit so it can't handle clicks. That means you need a git-client of some sort but that's a lot of work. It's much easier to let git output clickable text that fills the terminal's input prompt for the next git command. @zadjii-msft I think that would be perfect! |
In the screenshot the first command was typed manually. The second command was processed automatically by clicking the second link (next to |
The security needs of the debugger are different because the extensions that output DML are loaded and trusted by the debugger engine. For the PowerShell scenario, if WT sent a custom event, then PSReadLine could recognise that. It would work as well as allowing arbitrary sendinput, perhaps even better because the event handler could stash the line that is being edited and restore it afterwards. |
This is the the megathread for tracking all the remaining work that needs to be done for hyperlink support in Terminal.
"Soon" Timeframe
file://
URIs -> added in Support the "file" URI scheme #7526VtEngine::_SetHyperlink
usesfmt::format
to render the hyperlinks, and it should really use_WriteFormattedString
Controlling tooltip delay for URLs Controlling tooltip delay for URLs #8242Add a setting to disable auto detection of links (in PR v1.4.3141.0 show Windows Terminal (Preview) when right clicked on Task Bar #8239)Backlog
References
The text was updated successfully, but these errors were encountered: