diff options
Diffstat (limited to 'node_modules/ansi-escapes/index.js')
-rw-r--r-- | node_modules/ansi-escapes/index.js | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/node_modules/ansi-escapes/index.js b/node_modules/ansi-escapes/index.js index 4d47b1098..1122cbfb6 100644 --- a/node_modules/ansi-escapes/index.js +++ b/node_modules/ansi-escapes/index.js @@ -1,6 +1,9 @@ 'use strict'; const x = module.exports; const ESC = '\u001B['; +const OSC = '\u001B]'; +const BEL = '\u0007'; +const SEP = ';'; const isTerminalApp = process.env.TERM_PROGRAM === 'Apple_Terminal'; x.cursorTo = (x, y) => { @@ -75,12 +78,29 @@ x.scrollUp = ESC + 'S'; x.scrollDown = ESC + 'T'; x.clearScreen = '\u001Bc'; -x.beep = '\u0007'; +x.beep = BEL; + +x.link = (text, url) => { + return [ + OSC, + '8', + SEP, + SEP, + url, + BEL, + text, + OSC, + '8', + SEP, + SEP, + BEL + ].join(''); +}; x.image = (buf, opts) => { opts = opts || {}; - let ret = '\u001B]1337;File=inline=1'; + let ret = OSC + '1337;File=inline=1'; if (opts.width) { ret += `;width=${opts.width}`; @@ -94,9 +114,9 @@ x.image = (buf, opts) => { ret += ';preserveAspectRatio=0'; } - return ret + ':' + buf.toString('base64') + '\u0007'; + return ret + ':' + buf.toString('base64') + BEL; }; x.iTerm = {}; -x.iTerm.setCwd = cwd => '\u001B]50;CurrentDir=' + (cwd || process.cwd()) + '\u0007'; +x.iTerm.setCwd = cwd => OSC + '50;CurrentDir=' + (cwd || process.cwd()) + BEL; |