prompt-toolkit / prompt-toolkit/python-prompt-toolkit
heavy Processor called multiple times
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 10.6k
- Forks
- 815
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
I've developed a prompt that performs spellchecking by integrating the pyspellcheck library. However, I've noticed that underlining misspelled words causes a significant lag. I've optimized the spell-checking process by using caches, but the lag persists.
Upon further investigation, I added a print statement to the apply_transformation function and found that it is being called four times per keystroke. I attempted to create a ConditionalProcessor to address this, but there is no key_inserted event. Instead, I implemented hashing the buffer's text, but this approach breaks the underlining functionality entirely.
Any advice on how to resolve this issue would be greatly appreciated.
Thank you!
Sample: https://gist.github.com/planetis-m/ad078e0e184439e2712f3b853c192d01
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 with the sample gist and the prompt-toolkit code around the apply_transformation function to trace why it runs multiple times per keystroke. Review the attempted ConditionalProcessor and buffer-text hashing approach, then determine a way to avoid redundant spellchecking without breaking underlining. Done means the transformation no longer causes the reported lag while underlining remains functional.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100