Skip to content

Show hints on initial empty prompt (or expose refresh function) #26

@RiderALT

Description

@RiderALT

I'm using hints to show default values in an interactive CLI tool. The idea is simple — when the prompt appears with an empty line, show a grayed-out hint like "sisyphus" so the user knows what they'll get if they just press Enter.

The problem is that hints don't show up initially. They only appear after the user types something and deletes it. That's pretty confusing — you stare at an empty prompt, not knowing there's a default.

What happens now:
Branch: _ <- no hint, user has no idea there's a default
Branch: x_ <- user types 'x', still no hint (expected)
Branch: _sisyphus <- user deletes 'x', NOW the hint appears

I dug into the code and I think the issue is that linenoiseEditStart() doesn't call refreshLine() after displaying the prompt. So the hints callback never gets a chance to run until the user triggers a refresh by typing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions