How to make prompt-toolkit work on dumb terminals

See original GitHub issue

On dumb terminals (TERM=dumb or TERM=unkown) prompt-toolkit behaves strangely: Some message are not displayed, it expects arrow key support, etc.

I was wondering whether it is possible to swap the Vt100Input class for a class which offers genuinely less capabilities (i.e. no cursor movement, no arrow keys, etc).

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
halloleocommented, Dec 20, 2019

Wow, you are pretty quick with the fix!

I have tried it and it somewhat works. Examples like get-input.py or regular-language.py work fine and auto-suggestion.py, autocorrection.py and clock-input.py degrade reasonably.

However I noticed two things:

  1. When you run confirmation-prompt.py the print result is different: under vt100 terminals it is True/False,, under dumb terminals it is y/n.
  2. For apps using responds_to_cpr in vt100.py you still need to set the environment var PROMPT_TOOLKIT_NO_CPR for better degradation. Is there a chance to check for PROMPT_TOOLKIT_NO_CPR and for TERM=dumb?

Thanks heaps for looking into this!

0reactions
salotzcommented, Mar 5, 2020

+1 for this! My main use case is Emacs as well.

Read more comments on GitHub >

github_iconTop Results From Across the Web

python-prompt-toolkit - Bountysource
On dumb terminals (TERM=dumb or TERM=unkown) prompt-toolkit behaves ... It is possible to work around this by having key bindings defined as follows, ......
Read more >
How to Install prompt-toolkit in Python? - Finxter
Open your Linux terminal or shell · Type “ pip install prompt-toolkit ” (without quotes), hit Enter. · If it doesn't work, try...
Read more >
Faq - mycli
Once you get used to that level of pampering, all other REPLs start to look like Dumb Terminals. When I started using psql...
Read more >
FAQ - pgcli
Once you get used to that level of pampering, all other REPLs start to look like ... a new Python library that he's...
Read more >
your terminal doesn't support cursor position requests (CPR)
(setq python-shell-interpreter-args "--simple-prompt -i"). ipython assumes you have a "normal" terminal, but in Emacs it runs under a "dumb" ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found