Add quit_if_one_screen option for dynamic_paging mode#157
Open
keith-hall wants to merge 2 commits intoAMythicDev:mainfrom
Open
Add quit_if_one_screen option for dynamic_paging mode#157keith-hall wants to merge 2 commits intoAMythicDev:mainfrom
keith-hall wants to merge 2 commits intoAMythicDev:mainfrom
Conversation
Co-authored-by: keith-hall <11882719+keith-hall@users.noreply.github.com> Agent-Logs-Url: https://github.com/forkeith/minus/sessions/4a0e60ce-db58-455e-b6b1-815f7f4b411b
Co-authored-by: keith-hall <11882719+keith-hall@users.noreply.github.com> Agent-Logs-Url: https://github.com/forkeith/minus/sessions/8db94332-4c4f-4f84-9bda-7746f8a59750
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a
less -F-style auto-quit fordynamic_paging: when content fits on one screen and the end of output is signalled, the pager exits automatically and preserves the content on the terminal. Unlikeset_run_no_overflow(static mode only), this supports buffering use cases where the total line count is unknown upfront.New API
Pager::set_quit_if_one_screen(bool)— enables the feature. Whentrue, auto-quits with content preserved if it fits on screen once end-of-output is signalled. Otherwise the pager stays open for user scrolling/quitting.Pager::end_of_output()— explicitly signals end-of-output without dropping thePagerhandle. Preferred when the caller needs to keep the handle alive (e.g.bat's use case).Pagerclones also fires the signal automatically via anAliveGuardRAII type.Internals
AliveGuardholds a channel sender and firesCommand::CheckQuitIfOneScreenon drop;dynamic_pagingreceives its own independentArc<AliveGuard>so only the caller's clones count toward the signal.PagerState::quit_if_one_screen: booltracks the setting; theCheckQuitIfOneScreenhandler restores the terminal, writes formatted lines to the main screen, then respects the configuredExitStrategy.Usage