alot icon indicating copy to clipboard operation
alot copied to clipboard

how to not clear the screen on quit

Open archenemies opened this issue 4 years ago • 9 comments

Is your feature request related to a problem? Please describe.

Whenever I quit Alot, it clears the terminal. I find this frustrating because often the next thing I want to do depends in some way on what I am looking at on my terminal, so when the terminal gets cleared then I forget what I was going to do.

I've turned off the secondary screen feature on my terminal, and disabled the related escape sequences. This allows me to quit programs like Emacs without having the screen cleared.

Describe the solution you'd like

Either an option, like less -X, or using more standard terminal sequences like Emacs (?). Or devs telling me directly what I can do to prevent the screen from getting cleared by Alot.

Describe alternatives you've considered

I guess the alternatives for me would be modifying the code of Alot, and looking at what it is sending to my terminal to see if I can get the terminal to ignore it.

Thank you!

Additional context

Mutt and Neomutt also clear the screen, FWIW. However, Alot loads much faster and so it is easier to start and stop it. Neomutt I have to keep running in a screen session, and so I don't notice the problem of screen clearing on quit.

archenemies avatar Feb 16 '20 02:02 archenemies

Hi and welcome. In fact, I cannot reproduce this. When I exit alot, I get to see all my previous terminal content.. Is it possible that you're calling an external script in between (your editor?) which does that?

pazz avatar Feb 16 '20 10:02 pazz

Thank you.

When I exit alot, I get to see all my previous terminal content..

Is that the same as the secondary screen? I mean, when you exit alot, do you see (1) what was on the screen before you started alot? Or do you see (2) the list of alot messages, or whatever was showing just before you hit 'q'? I am expecting (2), since I disabled secondary screen. I will try to do some more investigating tomorrow.

archenemies avatar Feb 16 '20 18:02 archenemies

Quoting archenemies (2020-02-16 18:13:55)

Thank you.

When I exit alot, I get to see all my previous terminal content..

Is that the same as the secondary screen? I mean, when you exit alot, do you see (1) what was on the screen before you started alot? Or do you see (2) the list of alot messages, or whatever was showing just before you hit 'q'? I am expecting (2), since I disabled secondary screen. I will try to do some more investigating tomorrow.

Oh I see. I expect, and get (1) and believe that this is standard behaviour for urwid applications. I don't know what you mean by "secondary screen".

pazz avatar Feb 16 '20 18:02 pazz

The secondary/alternate screen is what you can turn off by setting XTerm*titeInhibit = true.

I found out that Neomutt changed recently to clear the alternate screen explicitly, due to a perceived security risk: https://github.com/neomutt/neomutt/issues/2146

I still haven't received a response to the issue I posted on the urwid repo.

Generally a full-screen curses application would default to using the alternate screen, but not clearing it. This way, users who prefer to disable the alternate screen can avoid gratuitous screen clearing.

archenemies avatar Feb 20 '20 05:02 archenemies

Thanks for this. I didn't know.

In any case, I believe the issue should be addressed in urwid as we don't do anything special in alot. Please just close this issue if you agree. P

pazz avatar Feb 20 '20 08:02 pazz

As I just noted here, it is possible to fix Urwid screen clearing.

However, Alot still clears the screen, even when I install the updated Urwid library. So I'm trying to figure out where this is happening in the Alot code...

archenemies avatar Mar 03 '20 22:03 archenemies

You could start your quest in alot/ui.py line 368, in which alot stops the asyncio event loop. I suspect you'll find what you're looking for in there or in some urwid wrapper around this event loop...

Quoting archenemies (2020-03-03 22:41:46)

Reopened #1469.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.*

pazz avatar Mar 04 '20 10:03 pazz

You will not be a fan of #1465 I presume..

pazz avatar May 08 '20 19:05 pazz

@pazz No that seems like a fine change to make. In the case of #1465, whatever gets cleared was going to disappear anyway, so I don't see why it would matter. Thank you for asking though.

archenemies avatar May 09 '20 01:05 archenemies

Hello here!

Just thought I should let you know this should have been resolved in https://github.com/urwid/urwid/pull/556. You can try to install urwid from the master branch to confirm.

See also: https://github.com/urwid/urwid/issues/521#issuecomment-1553822593

Thanks.

AnonymouX47 avatar May 19 '23 21:05 AnonymouX47

Thanks for the update!

pazz avatar May 20 '23 11:05 pazz