Closed KenjiTakahashi closed 9 years ago
Sorry, no. There's no way to do that.
About the closest you can get with the current code is to seed the history buffer, so the user can find it quickly with up
, tab
, or Ctrl-R
.
Yes, I have thought about this, but that's not really what I'd like to achieve.
Would you be willing to accept a PR on an additional function (PromptEdit
or sth) that does it? Maybe I'll be able to get my hands on that myself :-). Or maybe you have some idea how this could be implemented?
My first thought was "No, that doesn't work when $TERM=dumb", but after thinking some more I don't think that matters much. If you're on an unsupported terminal (or reading from stdin, or whatever), a missing suggestion isn't the end of the world.
Therefore, I would be willing to consider a Pull Request that adds such a function. I'd like to see the function also take a pos int
argument so you can set the cursor position to the place in the pre-filled text that you expect the user to start editing.
For the name, I was thinking PromptWithSuggestion
or PromptWithHint
or similar, but I'm not going to argue too much about the colour of your bikeshed.
Now that we have many types of prompt, maybe the password prompt should be renamed to something like PromptPassword to make the prompt names more consistent.
@ElPincheTopo That's a good idea for version 2, if we ever do one.
I'd love to be able to do something like
which will make a prompt
> sometext
wheresometext
is editable. Is there any way to do this?