Skip to content

readline: tabs not accepted is a bug or a feature? #1756

Closed
@Trott

Description

Inspired by #264, I was taking a look at https://github.com/nodejs/io.js/blob/2b1c01c2cc203dd6131c3fc6238cf62a2e697f63/lib/readline.js#L347-L349:

  //BUG: Problem when adding tabs with following content.
  //     Perhaps the bug is in _refreshLine(). Not sure.
  //     A hack would be to insert spaces instead of literal '\t'.

The issue (I think!) is this: If createInterface() is supplied with a completer option, that function is used for tab completion. If not completer function is supplied, then a no-op function is used. Either way, tabs are intercepted and the user cannot enter them.

I've updated the code so that if a completer function is supplied, you get tab completion but otherwise you can enter tab characters.

Before I submit a pull request, though, I'm wondering: Is this actually a bug? Or is it a feature that tab characters are not permitted in Interface.prototype.question()? Is the bug fix really just to mention it in the docs? (Maybe even that's overkill? It presumably isn't worth mentioning that you can't enter a line feed either...)

Metadata

Assignees

No one assigned

    Labels

    questionIssues that look for answers.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