prompt-toolkit / prompt-toolkit/python-prompt-toolkit
messy code is displayed with prompt occasionally
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 10.6k
- Forks
- 815
- PR merge metrics
- No merged PRs in 30d
Description
jonathanslenders,
When I run prompt with below format, messy code will be displayed occasionally as below. I am not sure whether it is a bug of python-prompt-toolkit. Can you help to have a look?
Thanks a lot in advance.
Nana
^[[35;1R file size limit(MB): 50
^[[70;1R has release extension: N
^[[70;1R node name: CGF01
`class EmailValidator(Validator):
self.func = None
def validate(self, document):
if len(document.text) > 0 and document.text[-1] == "!":
return
if self.func == None:
return
tmp_val = self.func(document.text)
if len(tmp_val):
raise ValidationError(message=tmp_val,
cursor_position=len(document.text))
for key, val in self.__setMap.items():
validator = EmailValidator();
validator.func = val
text = prompt(' %s: ' %key, default='%s' %str(self.__getMapkey), validator=validator)
if len(text) > 0 and text[-1] == "!":
return True
`
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 reproducing the intermittent output using the supplied prompt format, including the EmailValidator and prompt() calls. Inspect how prompt-toolkit handles terminal output and the displayed escape sequences, then confirm the behavior is consistently corrected without the messy code or control sequences.
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