[Python-ideas] Suggestion: Clear screen command for the REPL
Random832
random832 at fastmail.com
Tue Oct 4 10:22:54 EDT 2016
On Wed, Sep 28, 2016, at 23:36, Chris Angelico wrote:
> On Thu, Sep 29, 2016 at 12:04 PM, Steven D'Aprano <steve at pearwood.info>
> wrote:
> > (Also, it seems a shame that Ctrl-D is EOF in Linux and Mac, but Windows
> > is Ctrl-Z + Return. Can that be standardized to Ctrl-D everywhere?)
>
> Sadly, I suspect not. If you're running in the default Windows
> terminal emulator (the one a normal user will get by invoking
> cmd.exe), you're running under a lot of restrictions, and I believe
> one of them is that you can't get Ctrl-D without an enter.
Well, we could read _everything_ in character-at-a-time mode, and
implement our own line editing. In effect, that's what readline is
doing.
The main consequence of reading everything in character-at-a-time mode
is that we'd have to implement everything ourselves, and the line
editing you get *without* doing it yourself is somewhat nicer on Windows
than on Linux (it supports cursor movement, inserting characters, and
history).
On Wed, Sep 28, 2016, at 23:41, אלעזר wrote:
> "Bash on Ubuntu on windows" responds to CTRL+D just fine. I don't really
> know how it works, but it looks like it is based on the Windows terminal
> emulator.
It runs inside it, but it's using the "Windows Subsystem for Linux",
which (I assume) reads character-at-a-time and feeds it to a Unix-like
terminal driver, (which Bash then has incidentally also put in
character-at-a-time mode by using readline - to see what you get on WSL
*without* doing this, try running "cat" under bash.exe)
More information about the Python-ideas
mailing list