prompt-toolkit / prompt-toolkit/python-prompt-toolkit
How to pass formatted text to a buffer ?
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 10.6k
- Forks
- 815
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
After hours of reading the doc/code I still cannot find a way to use a buffer object with formatted text, let me explain:
In a minimalistic full screen application, I have a Window which consist in a scrollable text. Its content is being updated by another thread using buffer.insert_text() method.
I've tried a lot of solutions, even using processor, but cannot achieve to print coloured text (using HTML syntax for example)
I also tried to use a FormattedTextControl instead of a BufferControl, HTML works that way but then after the content is set at declaration, I cannot find a way to update it later.
I think I'm missing something, any clues ?
Thank you for your help
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
Start by reading the Buffer, BufferControl, and FormattedTextControl APIs and the processor documentation. Reproduce the scrollable Window update described with buffer.insert_text() and compare it with the declaration-time FormattedTextControl example. Done means establishing and documenting a supported way to update formatted text, or clearly documenting the limitation if no such path exists.
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