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

prompt, with completer, causes line state Wonkiness on Windows 10 when scroll buffer isn't empty

Open
#235 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Isn't completely clear if this is a prompt issue or not, but here's the repro:

  1. Fire up command prompt, ensure it's using the new conhost (Use legacy console not selected).
  2. Insert a bunch of stuff into the scroll buffer and ensure window scrolls a bit down before continuing
  3. Using the toolkit API, prompt for input with a completer attached
  4. Specify input
  5. Note line state starts to get Wonky(tm) after a few inputs (1 or more). May need to repeat steps 2-4 a few more times.

Animated gif showing me simplying typing A-E, hitting enter between each letter.
prompt

And the sample code

from prompt_toolkit import prompt
from prompt_toolkit.contrib.completers import WordCompleter
import sys

for i in range(50):
  print('--Scroll buffer filler--');
print('--End of scroll buffer filler--');

for i in range(5):
  html_completer = WordCompleter(['<html>', '<body>', '<head>', '<title>'])
  text = prompt('Prompt #%i: ' % i, completer = html_completer)
  print('Answer #%i: %s' % (i, text))

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 running the supplied Python sample using prompt and WordCompleter on Windows 10 with the new conhost and a non-empty scroll buffer. Reproduce the line-state corruption across repeated prompts, then verify that typing and completing input remains stable after the scroll buffer is populated.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.