Rework the "Reset and Clear" / "Erase Saved Lines" behaviors
The "Reset and Clear" menu entry has the issue that the shell prompt
disappears, one has to press Enter
(if the command line is surely empty) or
Ctrl
+L
or alike to make it appear again. This is confusing, especially to
users who aren't very familiar with the architectural separation of terminal
vs. shell. It was reported in gnome-terminal#6477 (closed), and frequently pops up on
various user forums. This is also dangerous if the user presses Enter
which
executes a previously typed in command that the user forgot about.
The "Erase Saved Lines" (ED 3
) escape sequence, typically emitted by clear
if the -x
flag is not given, or by reset
, is philosophically a problematic
one. On one hand, people find it convenient; on the other hand, it's worrisome
that an app's output can easily accidentally wipe out all previous outputs.
See #2342 and #2686.
With the help of Shell Integration escape sequences (#2681 (closed)), I propose the following changes:
-
Add a menu entry "Clear Previous Outputs" that clears everything up to (excluding) the latest shell prompt. The latest shell prompt + command line, and pending output underneath (if any) would remain.
-
Remove the "Reset and Clear" menu entry.
-
Remove support for
ED 3
.
An accidentally executed clear
, reset
or alike could no longer wipe out
pre[cv]ious outputs. Yet, if that was the user's goal, they could perform that
action quickly and conveniently (and not just when at a shell prompt).
Users could assign a hotkey to "Clear Previous Outputs". Maybe we could assign
Shift
+Ctrl
+L
by default, rhyming with bash
's Ctrl
+L
. Its effective
result would be what many users are looking for: clear everything, including
history, but keep the last prompt onscreen.
The "Reset" menu entry would remain as-is, along with the new "Clear Previous Outputs". I see no particular reason to keep a third menu entry that would execute these two at the same time. If someone wishes to execute both actions (which I can hardly see a reason for), they could invoke the two actions one after the other from the menu, or quickly press two hotkeys.
Pending dilemmas:
What should "Clear Previous Outputs" do if on the alternate screen?
How to preserve all lines of multiline prompts (either multiline by intent, or just happens to wrap)? It sounds the same as the dilemma of having to press the jumping hotkey twice: #2681 (comment 1904004).
Find a more brief UI label than "Clear Previous Outputs".