Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

REPL / built-in readline: Add CTRL-L support (clear screen) #11354

Open
neuschaefer opened this issue Apr 27, 2023 · 2 comments · May be fixed by #14332
Open

REPL / built-in readline: Add CTRL-L support (clear screen) #11354

neuschaefer opened this issue Apr 27, 2023 · 2 comments · May be fixed by #14332

Comments

@neuschaefer
Copy link
Contributor

Right now, the built-in readline implementation (shared/readline/readline.c) does not support CTRL-L, which is a somewhat common key to clear the the screen, and move the prompt and command line to the top of the screen. At least bash supports it.

This feature could be optional, and features like MICROPY_REPL_EMACS_KEYS already are, but the size savings wouldn't very much.

I might implement this myself If I get around to it. If anyone else want to do it, please let me know here.

@dpgeorge
Copy link
Member

This feature is actually implemented but in a library: upysh.clear (installable via mpremote mip install upysh, for example). See https://github.com/micropython/micropython-lib/blob/master/micropython/upysh/upysh.py

@neuschaefer
Copy link
Contributor Author

This feature is actually implemented but in a library: upysh.clear (installable via mpremote mip install upysh, for example). See https://github.com/micropython/micropython-lib/blob/master/micropython/upysh/upysh.py

As far as I can see, the upysh library doesn't hook into the readline implementation at all. My aim here is not to clear the screen from python code, not even to type clear() on the command line, but to replicate bash's convenience feature of being able to quickly clear the screen and move the current line of input to the top. Anything that isn't hooked into the readline implementation can't quite achieve that.

So, upysh is at best a reference for the control sequence that needs to be sent to the terminal.

neuschaefer added a commit to neuschaefer/micropython that referenced this issue Apr 19, 2024
This commit implements CTRL-L, a somewhat common key to clear the the
screen and move the prompt and command line to the top of the screen.
At least zsh, fish, ruby, and GNU readline support it.

Fixes: micropython#11354
neuschaefer added a commit to neuschaefer/micropython that referenced this issue Apr 19, 2024
This commit implements CTRL-L, a somewhat common key to clear the the
screen and move the prompt and command line to the top of the screen.
At least zsh, fish, ruby, and GNU readline support it.

Fixes: micropython#11354
neuschaefer added a commit to neuschaefer/micropython that referenced this issue Apr 19, 2024
This commit implements CTRL-L, a somewhat common key to clear the the
screen and move the prompt and command line to the top of the screen.
At least zsh, fish, ruby, and GNU readline support it.

Fixes: micropython#11354
Signed-off-by: J. Neuschäfer <j.ne@posteo.net>
neuschaefer added a commit to neuschaefer/micropython that referenced this issue Apr 20, 2024
This commit implements CTRL-L, a somewhat common key to clear the the
screen and move the prompt and command line to the top of the screen.
At least zsh, fish, ruby, and GNU readline support it.

Fixes: micropython#11354
Signed-off-by: J. Neuschäfer <j.ne@posteo.net>
neuschaefer added a commit to neuschaefer/micropython that referenced this issue Apr 22, 2024
This commit implements CTRL-L, a somewhat common key to clear the the
screen and move the prompt and command line to the top of the screen.
At least zsh, fish, ruby, and GNU readline support it.

Fixes: micropython#11354
Signed-off-by: J. Neuschäfer <j.ne@posteo.net>
neuschaefer added a commit to neuschaefer/micropython that referenced this issue Apr 22, 2024
This commit implements CTRL-L, a somewhat common key to clear the the
screen and move the prompt and command line to the top of the screen.
At least zsh, fish, ruby, and GNU readline support it.

Fixes: micropython#11354
Signed-off-by: J. Neuschäfer <j.ne@posteo.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants