You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: _docs/guides/link-handling.md
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ category: Guides
6
6
Clickable links may appear in the terminal output two ways:
7
7
8
8
* Emitted using an explicit escape sequence (OSC 8).
9
-
* Implicitly using something that looks a URL in the output recognized by the `web-links` addon using pattern matching.
9
+
* Implicitly using something that looks a URL in the output, recognized using pattern matching. This requires the `web-links` addon.
10
10
11
11
## Setup
12
12
@@ -29,12 +29,12 @@ webLinksAddon = new WebLinksAddon(activateLink, linkHandler);
29
29
xterm.options.linkHandler= linkHandler;
30
30
```
31
31
32
-
## Require modifier
32
+
## Require modifier key
33
33
34
-
Terminal emulators that handle clicking on a link commonly require a modifier to be pressed, to avoid unintentional window-opening. Commonly the `Ctrl` modifier (or on macOS the `Cmd` modifier) must be pressed.
34
+
Terminal emulators that handle clicking on a link usually require a modifier to be pressed, to avoid unintentional window-opening. Commonly the `Ctrl` modifier (or on macOS the `Cmd` modifier) must be pressed.
:typeof os !="undefined"?os.platform() =="darwin":false;
@@ -43,15 +43,15 @@ function isMac() {
43
43
// Replace activateLink above
44
44
functionactivateLink(event, uri) {
45
45
if ((isMac() ?event.metaKey:event.ctrlKey)
46
-
||!linkRequiesModifier()) {
46
+
||!linkRequiresModifier()) {
47
47
doHandleLink(); // example: open link in new browser window
48
48
}
49
49
}
50
50
```
51
51
52
52
## Display URL on hovering
53
53
54
-
It might helpful to show the full URL when overing over link, especally for links created by OSC 8 (which might not show the actual URL). This is safety feature commonly implemented in web browsers and mail readers.
54
+
It might be helpful to show the full URL when hovering over a link, especially for links created by OSC 8 (which might not show the actual URL). This is safety feature commonly implemented in web browsers and mail readers.
55
55
56
56
```js
57
57
let _linkPopup;
@@ -69,7 +69,7 @@ function showLinkPopup(event, text, range) {
69
69
popup.style.top= (event.clientY+25) +'px';
70
70
popup.style.right='0.5em';
71
71
popup.innerText= text;
72
-
if (linkRequiesModifier()) {
72
+
if (linkRequiresModifier()) {
73
73
popup.appendChild(document.createElement('br'));
74
74
conste2=document.createElement('i');
75
75
e2.innerText=`(${isMac() ?'Cmd':'Ctrl'}+Click to open link)`;
0 commit comments