Hyper: Cursor change on bell

Created on 29 Aug 2016  路  9Comments  路  Source: vercel/hyper

If I change default cursor and hit bell (tab or w/e) it switches to block:

This is a23022d5e0a7b9d04552337f057a4ac9489b033b built/run on Sierra.

help wanted Bug

Most helpful comment

I'm also experiencing this bug.

All 9 comments

I'm also experiencing this bug.

I can have a look at this one.

@robindboer Are you on Sierra as well? I haven't upgraded yet, so I'm wondering if the issue is specific to Sierra.

@maxdeviant I'm on Sierra but I have also experienced this issue on El Capitan. Thanks for having a look at this issue. Looking forward to the solution.

I'm able to reproduce consistently in zsh on OSX El Capitan.

The problem appears to be somewhere within hterm, but I have yet to track it down.

If you unfocus and then refocus the pane, the cursor will change back to the config value, since we call this.term.setCursorShape(nextProps.cursorShape); upon receiving props.

Looking inside of the node_modules/hterm-umdjs/dist/index.js, there are some places where it sets the cursor shape by itself:

hterm.VT.OSC['50']:

/**
 * Set the cursor shape.
 *
 * Parameter is expected to be in the form "CursorShape=number", where number is
 * one of:
 *
 *   0 - Block
 *   1 - I-Beam
 *   2 - Underline
 *
 * This is a bit of a de-facto standard supported by iTerm 2 and Konsole.  See
 * also: DECSCUSR.
 *
 * Invalid numbers will restore the cursor to the block shape.
 */
hterm.VT.OSC['50'] = function(parseState) {
  var args = parseState.args[0].match(/CursorShape=(.)/i);
  if (!args) {
    console.warn('Could not parse OSC 50 args: ' + parseState.args[0]);
    return;
  }

  switch (args[1]) {
    case '1':
      this.terminal.setCursorShape(hterm.Terminal.cursorShape.BEAM);
      break;

    case '2':
      this.terminal.setCursorShape(hterm.Terminal.cursorShape.UNDERLINE);
      break;

    default:
      this.terminal.setCursorShape(hterm.Terminal.cursorShape.BLOCK);
  }
};

hterm.VT.CSI[' q']:

/**
 * Set cursor style (DECSCUSR, VT520).
 *
 *   0 - Blinking block.
 *   1 - Blinking block (default).
 *   2 - Steady block.
 *   3 - Blinking underline.
 *   4 - Steady underline.
 */
hterm.VT.CSI[' q'] = function(parseState) {
  var 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 {
    console.warn('Unknown cursor style: ' + arg);
  }
};

I'm not fully sure what these do, and am having trouble figuring out if they are actually called at all, but they do seem like primary suspects for this bug.

Interestingly enough, it seems like hterm.Terminal.prototype.setCursorShape is only called once during runtime. When the cursor changes to BLOCK in the repro case, that method is not fired 馃槓

I am also experiencing this issue. One detail though, if you unfocus the window, then refocus it, the cursor will change back.

I may have time to look into it, but I can't make any promises. 馃槃

Encounter this issue on macOS Sierra and Hyper 0.8.3.873, I change cursor shape to BEAM in hyper.js but it sometime still block

Was this page helpful?
0 / 5 - 0 ratings

Related issues

eoinmurray picture eoinmurray  路  3Comments

sarneeh picture sarneeh  路  3Comments

laur1s picture laur1s  路  3Comments

aem picture aem  路  3Comments

juicygoose picture juicygoose  路  3Comments