Add VTX hyperlink support for URLs

This commit is contained in:
Bryan Ashby 2017-09-21 21:23:30 -06:00
parent 7837a2a7bd
commit b0260049ba
5 changed files with 26 additions and 5 deletions

View file

@ -56,7 +56,7 @@ exports.getSyncTERMFontFromAlias = getSyncTERMFontFromAlias;
exports.setSyncTermFontWithAlias = setSyncTermFontWithAlias;
exports.setCursorStyle = setCursorStyle;
exports.setEmulatedBaudRate = setEmulatedBaudRate;
exports.getVtxHyperlink = getVtxHyperlink;
//
// See also
@ -485,3 +485,14 @@ function setEmulatedBaudRate(rate) {
}[rate] || 0;
return 0 === speed ? exports.emulationSpeed() : exports.emulationSpeed(1, speed);
}
function getVtxHyperlink(client, url, text) {
if(!client.terminalSupports('vtx_hyperlink')) {
return '';
}
text = text || url;
url = url.split('').map(c => c.charCodeAt(0)).join(';');
return `${ESC_CSI}1;${text.length};1;1;${url}\\`;
}