Skip to content
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

Open
11 of 22 tasks
zadjii-msft opened this issue Mar 18, 2020 · 46 comments
Open
11 of 22 tasks

Scenario: Add support for hyperlinks #5001

zadjii-msft opened this issue Mar 18, 2020 · 46 comments
Assignees
Labels
Area-User Interface Issues pertaining to the user interface of the Console or Terminal Area-VT Virtual Terminal sequence support Issue-Scenario Product-Terminal The new Windows Terminal.
Milestone

Comments

@zadjii-msft
Copy link
Member

zadjii-msft commented Mar 18, 2020

This is the the megathread for tracking all the remaining work that needs to be done for hyperlink support in Terminal.

"Soon" Timeframe

Backlog

References

@ghost ghost added Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels Mar 18, 2020
@DHowett-MSFT DHowett-MSFT removed the Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting label Mar 18, 2020
@miniksa miniksa added ⛺ Reserved For future use and removed Needs-Tag-Fix Doesn't match tag requirements labels Jul 6, 2020
@PankajBhojwani PankajBhojwani changed the title [Reserved for future use] Scenario: Add support for hyperlinks Aug 19, 2020
@PankajBhojwani PankajBhojwani added Area-VT Virtual Terminal sequence support Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Product-Terminal The new Windows Terminal. Issue-Scenario Area-User Interface Issues pertaining to the user interface of the Console or Terminal and removed ⛺ Reserved For future use Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. labels Aug 19, 2020
@DHowett
Copy link
Member

DHowett commented Aug 20, 2020

Proposed order of attack:

  • Hover tooltip
  • Rendering -- possibly simple rendering w/ a new underline style for me?
  • Take a break, regroup, think about the design for autodetection
  • (possibly work on other things in the meantime)
  • Autodetection

@zadjii-msft
Copy link
Member Author

Hey so hover tooltip might be hard - we can't embed a webview, so doing something like
image

Might be especially hard. But we could start with a TeachingTip sytle one for now
image

Unless we could somehow pre-render a web page to an image and display that in the tooltip. Or use something like the "social" image from github (though I haven't the damndest clue how that works.)

Maybe we should just start with

Open [web page | file]: 
{url}

in the tooltip

@zadjii-msft zadjii-msft added this to the Terminal v2.0 milestone Aug 21, 2020
@DHowett
Copy link
Member

DHowett commented Aug 21, 2020

Yeah i definitely think tooltip and “the link preview from the video” are different workitems that we should tackle separately :)

@j4james
Copy link
Collaborator

j4james commented Aug 22, 2020

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?

@DHowett
Copy link
Member

DHowett commented Aug 22, 2020

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.

@jzabroski
Copy link

  • Allow mailto: URIs

Would this be RFC conforming 😒 mailto: URL, or 😍 mailto: URL that allows multiple email addresses?

@DHowett
Copy link
Member

DHowett commented Sep 3, 2020

Generally, "whatever type of thing is supported by the registered protocol handler" ;P

@jantari
Copy link
Contributor

jantari commented Sep 3, 2020

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

@DHowett
Copy link
Member

DHowett commented Sep 3, 2020

Thanks @jantari! Just added that to the main scenario body.

@giggio
Copy link

giggio commented Sep 3, 2020

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?

@vefatica
Copy link

vefatica commented Mar 11, 2021

ftp:// ... I get underlining and a popup "Ctrl+click" tip but can't follow it.

mailto:// ... nothing.

What's the plan? Thanks.

@DHowett
Copy link
Member

DHowett commented Mar 11, 2021

to be fair, mailto isn’t traditionally followed by // as it does not designate a path. We have issues tracking both “let me customize the URL regex” and “expand protocol support.”

So that’s the plan.

@KalleOlaviNiemitalo
Copy link

@vefatica, in v1.7.572.0, TerminalPage::_IsUriSupported allows only http, https, and file. Other URI schemes have been discussed in #7562.

@vefatica
Copy link

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

@KalleOlaviNiemitalo
Copy link

According to #7691 (comment), ftp: hyperlinks were going to be unblocked "shortly"; but almost five months have passed already. The regex in v1.7.572.0:

std::wstring_view linkPattern{ LR"(\b(https?|ftp|file)://[-A-Za-z0-9+&@#/%?=~_|$!:,.;]*[A-Za-z0-9+&@#/%=~_|$])" };

@zadjii-msft zadjii-msft mentioned this issue Apr 29, 2021
20 tasks
@heaths
Copy link
Member

heaths commented May 25, 2021

file:// links with \\wsl$ yield an error dialog despite working as-is from the Windows Run dialog. I opened #10188 to track, unless you wanted to keep this issue as an evergreen source of outstanding issues.

@phil-blain
Copy link

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!

@zadjii-msft
Copy link
Member Author

@phil-blain From #9491

I'd rather not get us into the business of launching specific applications for URLs specifically. Once we add configurable pattern detection and matching (which is on the backlog somewhere), we'll also add pattern execution. That'll let folks customize which browser launches for which patterns.

see #8849

@ironyman
Copy link
Contributor

@zadjii-msft
Just wondering, how hard would it be to let console applications emit hyperlinked text? E.g. if dir could output hyperlinked file names which are clickable and launches the files that would be pretty cool. Like the Symbolics Genera terminals https://www.youtube.com/watch?v=o4-YnLpLgtk

@lucy
Copy link

lucy commented Aug 28, 2022

@ironyman
You can already do this with OSC 8 (https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda) which Windows Terminal supports AFAIK.

@zadjii-msft
Copy link
Member Author

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, though, I don't think we support file:// URIs quite yet. There's complicated reasons for that, which are probably mentioned in # NEVERMIND I was wrong. See #7526. Neato!

Then there's always the issue of updating the utilities to make use of that sequence. Updating the dir in cmd is pretty much off the table, but PowerShell's gci might have more luck.

@heaths
Copy link
Member

heaths commented Aug 29, 2022

I don't think we support file:// URIs quite yet. There's complicated reasons for that, which are probably mentioned in # NEVERMIND I was wrong. See #7526. Neato!

Though, #10188 still means they don't work for WSL URIs. 😉

@ironyman
Copy link
Contributor

ironyman commented Sep 14, 2022

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 git branch, then you could click on one of the branches and terminal would fill the input prompt with git checkout (branch name). That would be super cool.

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?

@zadjii-msft
Copy link
Member Author

zadjii-msft commented Sep 14, 2022

@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?

Would it be something like:
image>


Since I'm keeping notes here:

clickable sendInput

ee80820

dev/migrie/fhl-clickable-send-input

@jantari
Copy link
Contributor

jantari commented Sep 14, 2022

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.

@KalleOlaviNiemitalo
Copy link

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.

@KindDragon
Copy link

KindDragon commented Sep 14, 2022

Would it be something like: image

Looks similar to https://fig.io. I would love to see it on Windows

@ironyman
Copy link
Contributor

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.

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!

@SeeminglyScience
Copy link

WinDbg's console is a good showcase of how useful "click to send input" could be.

image

In the screenshot the first command was typed manually. The second command was processed automatically by clicking the second link (next to MethodTable). I think PowerShell (and probably everything else really) could use this type of feature extensively in object formatting to greatly improve workflow, especially for newer folks.

@KalleOlaviNiemitalo
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-User Interface Issues pertaining to the user interface of the Console or Terminal Area-VT Virtual Terminal sequence support Issue-Scenario Product-Terminal The new Windows Terminal.
Projects
None yet
Development

No branches or pull requests