diff options
author | Florian Dold <florian.dold@gmail.com> | 2018-09-20 02:56:13 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2018-09-20 02:56:13 +0200 |
commit | bbff7403fbf46f9ad92240ac213df8d30ef31b64 (patch) | |
tree | c58400ec5124da1c7d56b01aea83309f80a56c3b /node_modules/ansi-escapes/index.js | |
parent | 003fb34971cf63466184351b4db5f7c67df4f444 (diff) |
update packages
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; |