click icon indicating copy to clipboard operation
click copied to clipboard

backspace and line-wrapping acting strange on Linux

Open yorickvP opened this issue 6 months ago • 4 comments

When running any app using click.prompt on linux, something weird happens with backspace.

Recording

This screen recording shows 2 letters being removed when I hit backspace once, and the prompt being deleted when I backspace the entire line.

Image (asciinema link)

The returned input is also different from the text shown on screen.

Environment:

  • Python version: 3.13.3
  • Click version: 8.2.1

Cause:

termui contains a workaround for windows where it prints a readline prompt itself. On linux, this confuses readline so things like backspace/ctrl-backspace and line wrapping don't work correctly.

This can be fixed by letting readline handling the prompt on linux: #2969

yorickvP avatar Jun 07 '25 09:06 yorickvP

Please include the full context on the issue.

Rowlando13 avatar Jun 16 '25 07:06 Rowlando13

I updated the description to include a cause from the PR.

(Looks like the asciinema demo is currently down, if it's still down tomorrow I'll upload it somewhere else.)

yorickvP avatar Jun 16 '25 11:06 yorickvP

Thanks for the update. I still need you to include the full context even if it's screenshots. That site being down is an example of why we require it.

Rowlando13 avatar Jun 17 '25 09:06 Rowlando13

Updated with an inline gif showing the bug.

yorickvP avatar Jun 17 '25 09:06 yorickvP