MCPcopy Index your code
hub / github.com/xtermjs/xterm.js / setHyperlink

Method setHyperlink

src/common/InputHandler.ts:3008–3024  ·  view source on GitHub ↗

* OSC 8 ; ; ST - create hyperlink * OSC 8 ; ; ST - finish hyperlink * * Test case: * * ```sh * printf '\e]8;;http://example.com\e\\This is a link\e]8;;\e\\\n' * ``` * * @vt: #Y OSC 8 "Create hyperlink" "OSC 8 ; params ; uri BEL" "Create a hyperlin

(data: string)

Source from the content-addressed store, hash-verified

3006 * feedback. Use `OSC 8 ; ; BEL` to finish the current hyperlink.
3007 */
3008 public setHyperlink(data: string): boolean {
3009 // Arg parsing is special cases to support unencoded semi-colons in the URIs (#4944)
3010 const idx = data.indexOf(';');
3011 if (idx === -1) {
3012 // malformed sequence, just return as handled
3013 return true;
3014 }
3015 const id = data.slice(0, idx).trim();
3016 const uri = data.slice(idx + 1);
3017 if (uri) {
3018 return this._createHyperlink(id, uri);
3019 }
3020 if (id.trim()) {
3021 return false;
3022 }
3023 return this._finishHyperlink();
3024 }
3025
3026 private _createHyperlink(params: string, uri: string): boolean {
3027 // It's legal to open a new hyperlink without explicitly finishing the previous one

Callers 1

constructorMethod · 0.95

Calls 2

_createHyperlinkMethod · 0.95
_finishHyperlinkMethod · 0.95

Tested by

no test coverage detected