AMythicDev / minus

An asynchronous, runtime data feedable terminal paging library for Rust
https://crates.io/crates/minus/
Apache License 2.0
317 stars 23 forks source link

Add a way to persist the alternate screen on exit #128

Open benbrittain opened 7 months ago

benbrittain commented 7 months ago

I was looking for a way to get similar behavior to -X with less, where the buffer stays on screen after exit.

AMythicDev commented 7 months ago

Could you please fix the code issues pointed by the CI so that I can further test it?

AMythicDev commented 6 months ago

@benbrittain So I was busy for a while and I didn't get time to review this properly. Although you did most of the part correctly, you missed the mark in the actual implementation. The change that you did to cleanup() function causes the alternate screen to stay even after the pager is closed.

The alternate screen is meant to show complex UIs on the terminal without polluting the canonical screen whereas shells always run in the canonical screen. Its the sole responsibility of a program to start as well as exit the alternate screen so that the shell can continue running in the canonical screen.

By your approach we are not exiting the alternate screen and hence after quitting, the the shell continues to run in the alternate screen. This is an absolutely weird behavior and just a broken way to achieve the thing that you want. So I am not taking this right now until there's a better way of achieving the same effect or I get some more compelling reason to accept this.