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.
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.