Skip to content

Refactor pager class#132

Merged
harro merged 6 commits intomasterfrom
Pager
Apr 17, 2025
Merged

Refactor pager class#132
harro merged 6 commits intomasterfrom
Pager

Conversation

@harro
Copy link
Collaborator

@harro harro commented Mar 23, 2025

While preparing the 2.0.0 release I noticed some inconsistent Pager behaviour.
I subsequently ran into trouble trying to localise the issue by adding tests...
So I spent the weekend refactoring the Pager class to make unit testing easier. I added many more tests, then found and resolved several issues.

Issue(s) resolved:
SetLines was being ignored
Percent was conditionally displayed
Only every 2nd 'enter' key was being registered by tty.read
Prompt string did not truncate on narrow terminals
Added support for MS Windows

Apologies for the lengthy CL - I combined it all together so we can proceed with system/regression test as part of this CL review.

@harro harro requested a review from buxtronix March 23, 2025 08:22
@harro harro self-assigned this Mar 23, 2025
@github-advanced-security
Copy link

This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation.

@harro harro mentioned this pull request Mar 24, 2025
@harro
Copy link
Collaborator Author

harro commented Apr 4, 2025

Updated list of issues resolved ...

  1. First line of output was not being displayed (off by one error).
  2. SetLines was being ignored. Page size was fixed to terminal size.
  3. Percent was conditionally displayed. It now displays when paging additional input.
  4. Only every 2nd 'enter' key was registered by tty.read, switched to using 'n' key instead.
  5. Prompt string did not truncate on narrow terminals
  6. Added paging support for MS Windows terminals

@harro
Copy link
Collaborator Author

harro commented Apr 12, 2025

  • Pager no longer exits automatically at end of buffer - This is the preferred behavior
  • Fixes day-one issue of non displaying empty lines

@harro
Copy link
Collaborator Author

harro commented Apr 12, 2025

Oh, and returned the conditional display of the % progress, as this is the preferred behavior for streamed input

@harro
Copy link
Collaborator Author

harro commented Apr 12, 2025

Also correctly handles files smaller than the terminal

@harro harro merged commit 735ff6d into master Apr 17, 2025
3 checks passed
jhogg pushed a commit to jhogg/textfsmplus that referenced this pull request Dec 16, 2025
* Refactor pager class
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants