AMythicDev / minus

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

FX mode #129

Open benbrittain opened 9 months ago

benbrittain commented 9 months ago

Is your feature request related to a problem? Please describe. I'm using minus as a pager in a program where we would like functionality similar to less -FRX where it would be nice to have the output remain on screen after it exits (less -X) and automatically exit if the entire file can be displayed on the screen (less -F). This ideally would also mean not clearing prior scroll-back when the entire file or less can be displayed.

Describe the solution you'd like

I took a first pass at -X in #128 . I'm not sure what the right approach for -F is.

AMythicDev commented 9 months ago

I will work on the -F functionality. Please fix your code in #128.

AMythicDev commented 9 months ago

I cam up with a basic implementation of -F behaviour in minus but there are a couple of points to be noted.

  1. There will be a function like Pager::eof() to mark the end of data. Any further call to Pager::set_text() or Pager::push_str() will cause a panic. Other functions may work normally.
  2. Its best if we get the info about the data prior to the starting of the display (which means before calling dynamic_paging()/static_paging(). Otherwise if the display starts and then we call the Pager::eof() and then minus realises that the entire data can be fit in the screen without a display, it will close the display and rewrite the text on the normal screen which is sort of wonky.
AMythicDev commented 9 months ago

@benbrittain hey man I just wanted to give a reminder that you fix #128 because I also have to merge #65 which is quite big and I am sure it will cause merge conflicts with your PR and you're gonna have to double the effort to fix ci as well as fix the merge conflicts. Also I have to test the PR to ensure it works all to well.