Skip to content

Commit 1a2b3d1

Browse files
authored
Merge pull request #221 from PerBothner/link-handling
Fix minor typos and awkward phrases in link-handler guide
2 parents 4ad0567 + 2c265e9 commit 1a2b3d1

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

_docs/guides/link-handling.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ category: Guides
66
Clickable links may appear in the terminal output two ways:
77

88
* 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.
1010

1111
## Setup
1212

@@ -29,12 +29,12 @@ webLinksAddon = new WebLinksAddon(activateLink, linkHandler);
2929
xterm.options.linkHandler = linkHandler;
3030
```
3131

32-
## Require modifier
32+
## Require modifier key
3333

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.
3535

3636
```js
37-
function linkRequiesModifier() { return true; }
37+
function linkRequiresModifier() { return true; }
3838
function isMac() {
3939
return typeof navigator != "undefined" ? /Mac/.test(navigator.platform)
4040
: typeof os != "undefined" ? os.platform() == "darwin" : false;
@@ -43,15 +43,15 @@ function isMac() {
4343
// Replace activateLink above
4444
function activateLink(event, uri) {
4545
if ((isMac() ? event.metaKey : event.ctrlKey)
46-
|| ! linkRequiesModifier()) {
46+
|| ! linkRequiresModifier()) {
4747
doHandleLink(); // example: open link in new browser window
4848
}
4949
}
5050
```
5151

5252
## Display URL on hovering
5353

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.
5555

5656
```js
5757
let _linkPopup;
@@ -69,7 +69,7 @@ function showLinkPopup(event, text, range) {
6969
popup.style.top = (event.clientY + 25) + 'px';
7070
popup.style.right = '0.5em';
7171
popup.innerText = text;
72-
if (linkRequiesModifier()) {
72+
if (linkRequiresModifier()) {
7373
popup.appendChild(document.createElement('br'));
7474
const e2 = document.createElement('i');
7575
e2.innerText = `(${isMac() ? 'Cmd' : 'Ctrl'}+Click to open link)`;

0 commit comments

Comments
 (0)