prompt-toolkit / prompt-toolkit/python-prompt-toolkit
How to change text and cursor position after selecting suggestion?
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 10.6k
- Forks
- 815
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
First of all, thank you very much for your amazing work, @jonathanslenders, bravo!
So I have a small question: I'm trying to implement a CLI editor for key/value pairs. I would like to modify the selected text, add double quotes and put cursor between them, so that user would immediately start typing a value. But I don't want to display those extra characters in the suggestion list. Could you please give me some pointers how such behaviour might be implemented?
E.g. if we have a list of options Foo, Bar, Baz and user selects Bar, that's how it would look (_ is cursor position after selecting the suggestion):
> Bar: "_"
Thank you very much!
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
This is a usage question rather than a scoped change: the report names no files, tests, or entry points. Begin by locating the documented suggestion-selection and cursor-editing APIs; done would be a maintainer-confirmed implementation path for replacing selected text and positioning the cursor.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100