prompt-toolkit / prompt-toolkit/python-prompt-toolkit

how to pass text in prompt buffer to bottom toolbar or rprompt callables?

Open
#991 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
10.6k
Forks
815
PR merge metrics
No merged PRs in 30d

Description

Sorry if I'm missing an obvious here:

How can I access the text being entered by the user in the prompt (in the buffer?) in the bottom_toolbar (or rprompt) callables that I define?

Just trying to do what is already doable with the Validator.validate(self, document) abstract method, which exposes the document object (and its text attribute) which provides access to the content of the buffer. This allows modification of the message in the bottom toolbar based on the user input, however is reliant on raising a ValidationError which also blocks "entering" the actual entry of the value which I'd like to avoid.

Thank you!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the bottom_toolbar and rprompt callable APIs alongside Validator.validate(self, document), focusing on how each callable receives or accesses prompt state. Confirm whether the current buffer text can be exposed without raising ValidationError, and document or test the chosen behavior so toolbar output updates while normal submission remains possible.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.