contour icon indicating copy to clipboard operation
contour copied to clipboard

ClearHistoryAndReset does not have the most useful behavior

Open zopieux opened this issue 2 years ago • 10 comments
trafficstars

Contour Terminal version

0.3.1-2022-05-01

Installer source

something else (please specify below)

Operating System

NixOS

Architecture

x86-64

Other Software

No response

Steps to reproduce

Bind a shortcut for ClearHistoryAndReset and trigger it.

Expected Behavior

Contour clears the buffer and history, the terminal shows only the empty shell prompt and the cursor is positioned at the end of the prompt.

This is the behavior I experience under Konsole for the action called “Clear scrollback and reset”.

Actual Behavior

Contour clears the buffer and history, the terminal shows absolutely nothing (not even the prompt) and the cursor is at the very top-left of the empty terminal window.

This behavior feels "crude", like something is broken since the prompt is gone. Resetting to a clean shell, with its prompt ready and visible, sounds more useful and intuitive to me.

Additional notes

No response

zopieux avatar Oct 10 '23 20:10 zopieux

Some additional info https://github.com/contour-terminal/contour/discussions/921 Maybe it's time to rename it @christianparpart what do you think ?

Yaraslaut avatar Oct 10 '23 20:10 Yaraslaut

I have to revive my brain on this (including on #921), but I remember that the implementation of ClearHistoryAndReset was non-trivial (BUT used to work). Due to its magic trick to get the shell (or app) to re-draw the screen, there was a double window resize event propagated, with a slight delay in the middle.

Thanks for the report @zopieux. We need to think a little about it on how we want to "rework" this, so it seems. :)

christianparpart avatar Oct 10 '23 20:10 christianparpart

To clarify, the default ClearHistory (Ctrl-L) behavior, which can also be achieved by typing clear in the shell, is also not what this bug is about. ClearHistory is fine and useful, but in my case I actually want to discard all the buffered scrollback.

zopieux avatar Oct 10 '23 20:10 zopieux

btw, @zopieux, I just noticed that you. are on NixOS and use the official package. We should again try to push NixOS to update the Contour package. I remember there was an attempt and I do not know why it didn't make it through. 🤔

christianparpart avatar Oct 10 '23 20:10 christianparpart

Yeah I saw my package was super old after the fact, sorry. There is already an open but stale PR from June. This is just the typical NixOS PR lifecycle, sadly. Someone™ has to care.

zopieux avatar Oct 10 '23 20:10 zopieux

Ah, many thanks for linking it. I do not know what to do in order to push for getting it merged. Maybe I can have a look soonish. I am having a NixOS VM here, but the reason why I'm not really using it, is, that the graphics is really bad (and that's only for NixOS, all other VMs work great) - sadly.

FYI: We're also very close to releasing 0.4.0, the next major stable, that will contain a rather long list of fixes plus features.

Maybe we can get some nix flake PR into contour instead, such that users can use this for installing Contour instead? I only heard of nix flakes to be the way to go, but I have never tried them as of yet.

christianparpart avatar Oct 10 '23 20:10 christianparpart

Having a flake maintained in this here repository is definitely the way to go, I'd gladly recommend it! If a flake exists, maintenance of the corresponding nixpkgs package is also way simpler.

zopieux avatar Oct 12 '23 21:10 zopieux

@zopieux you don't happen to know how to do that and would love to contribute to contour by creating a PR for it, do you? It is HacktoberFest afterall! 🥳

christianparpart avatar Oct 13 '23 06:10 christianparpart

if we look at clear command, in documentation we see following : https://www.gnu.org/software/screen/manual/html_node/Clear.html meaning that we save current screen, and full vt sequence is : \033[3J\033[H\033[2J I would like not to save current screen in the scrollback and have a sequence \033[2J\033[H\033[3J, so i think we should use this sequence and rename it into sometihng like ClearWithHistory

Yaraslaut avatar Dec 18 '23 08:12 Yaraslaut

maybe we can refer to the practices of Windows Terminal and XShell

294797392 avatar Jul 11 '24 10:07 294797392