Skip to content

REPL in editor mode crashes during tab completion  #43528

Closed
@cola119

Description

@cola119

Version

v18.4.0

Platform

No response

Subsystem

No response

What steps will reproduce the bug?

$ node
Welcome to Node.js v18.4.0.
Type ".help" for more information.
> .editor
// Entering editor mode (Ctrl+D to finish, Ctrl+C to cancel)
a

And then press TAB

How often does it reproduce? Is there a required condition?

always

What is the expected behavior?

Works without problems.

What do you see instead?

> .editor
// Entering editor mode (Ctrl+D to finish, Ctrl+C to cancel)
anode:internal/readline/emitKeypressEvents:74
            throw err;
            ^

TypeError: Cannot read properties of undefined (reading 'length')
    at commonPrefix (node:internal/readline/utils:375:27)
    at [_tabCompleter] (node:internal/readline/interface:670:20)
    at node:readline:448:24
    at node:repl:1606:3
    at completionGroupsLoaded (node:repl:1592:5)
    at REPLServer.complete (node:repl:1489:7)
    at REPLServer.completer (node:repl:762:5)
    at Interface._tabComplete (node:readline:440:8)
    at [_ttyWrite] [as _ttyWrite] (node:internal/readline/interface:1319:31)
    at REPLServer.self._ttyWrite (node:repl:1029:11)

Node.js v18.4.0

Additional information

Now I'm working on this. I'll send a PR in later.

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugIssues with confirmed bugs.replIssues and PRs related to the REPL subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions