mirror of
https://github.com/nushell/nushell.git
synced 2024-11-28 11:24:09 +01:00
eedf833b6f
Fixes #14176 # Description Since the Linux `/usr/bin/clear` binary doesn't exhibit the issue in #14176, I checked to see what ANSI escapes it is emitting: ```nu nu -c '^clear; "111\n222\n333"' | less # or bash -c 'clear -x; echo -e "111\n222\n333"' | less ``` Both show the same thing: ``` ESC[HESC[2JESC[3J111 222 333 (END) ``` This is the equivalent of: ```nu $"(ansi home)(ansi clear_entire_screen)(ansi clear_entire_screen_plus_buffer)111\n222\n333" ``` However, our internal `clear` is sending only the Home and 3J. While this *should*, in theory, work, it's (a) clear that it doesn't, and (b) `/usr/bin/clear` seemingly knows this and already has the solution (or at least workaround). From looking at the `ncurses` source, it appears it is getting this information from the terminal capabilities. That said, support for `2J` and `3J` is fairly universal, and it's what we send in `clear` and `clear --keep-scrollback` anyway, so there's no harm AFAICT in sending both like `/usr/bin/clear` does. Also tested and fixes the issue on Windows. Note that PowerShell `Clear-Host` also did not have the issue. Side-note: It's interesting that on Tmux, which doesn't support 2J and 3J, that `/usr/bin/clear` knows this and doesn't send those codes, sending just an escape-[J instead. However, Nushell's `clear`, of course, isn't checking terminal capabilities, and is continuing to send the unsupported codes. Fortunately this doesn't appear to cause any issues on Tmux. # User-Facing Changes None, AFAICT - Bugfix only. # Tests + Formatting - 🟢 `toolkit fmt` - 🟢 `toolkit clippy` - 🟢 `toolkit test` - 🟢 `toolkit test stdlib` # After Submitting N/A |
||
---|---|---|
.. | ||
src | ||
tests | ||
Cargo.toml | ||
LICENSE | ||
README.md |
This crate contains the majority of our commands
We allow ourselves to move some of the commands in nu-command
to nu-cmd-*
crates as needed.
Internal Nushell crate
This crate implements components of Nushell and is not designed to support plugin authors or other users directly.