From ccf818de5a4dcd6da093b76a70b1d19b5a92474c Mon Sep 17 00:00:00 2001 From: Theodore Dubois Date: Sat, 24 Dec 2016 10:29:52 -0800 Subject: [PATCH] Add support for cursor styles 5 and 6 to hterm (#1286) This fixes #270, cursor shape changing in Neovim. --- lib/hterm.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/lib/hterm.js b/lib/hterm.js index d3750ee4..647ce440 100644 --- a/lib/hterm.js +++ b/lib/hterm.js @@ -427,5 +427,31 @@ lib.colors.hexToRGB = function (arg) { return arg; }; +// add support for cursor styles 5 and 6, fixes #270 +hterm.VT.CSI[' q'] = function (parseState) { + const arg = parseState.args[0]; + if (arg === '0' || arg === '1') { + this.terminal.setCursorShape(hterm.Terminal.cursorShape.BLOCK); + this.terminal.setCursorBlink(true); + } else if (arg === '2') { + this.terminal.setCursorShape(hterm.Terminal.cursorShape.BLOCK); + this.terminal.setCursorBlink(false); + } else if (arg === '3') { + this.terminal.setCursorShape(hterm.Terminal.cursorShape.UNDERLINE); + this.terminal.setCursorBlink(true); + } else if (arg === '4') { + this.terminal.setCursorShape(hterm.Terminal.cursorShape.UNDERLINE); + this.terminal.setCursorBlink(false); + } else if (arg === '5') { + this.terminal.setCursorShape(hterm.Terminal.cursorShape.BEAM); + this.terminal.setCursorBlink(true); + } else if (arg === '6') { + this.terminal.setCursorShape(hterm.Terminal.cursorShape.BEAM); + this.terminal.setCursorBlink(false); + } else { + console.warn('Unknown cursor style: ' + arg); + } +}; + export default hterm; export {lib};