Skip to content

Readline keypress event is triggered only after pressing Esc key 3 times #7379

Description

@sindresorhus
  • Version: 6.2.2 and 4.4.5
  • Platform: macOS 10.11.5
  • Subsystem: readline

Test case

const readline = require('readline');
readline.emitKeypressEvents(process.stdin);
process.stdin.setRawMode(true);
process.stdin.on('keypress', console.log);

Expected

After pressing Esc once, I would get this output:

undefined { sequence: '\u001b',
  name: 'escape',
  ctrl: false,
  meta: true,
  shift: false }

Actual

After pressing Esc three times, I get this output:

undefined { sequence: '\u001b\u001b\u001b',
  name: 'escape',
  ctrl: false,
  meta: true,
  shift: false }

It works fine on 0.10.44 and 0.12.13. After pressing Esc once:

{ name: 'escape',
  ctrl: false,
  meta: false,
  shift: false,
  sequence: '\u001b' }

Also notice that meta is false here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugIssues and PRs for confirmed bugs.readlineIssues and PRs related to the built-in readline module.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions