Skip to content

Keep pager state local to the client loop - #139

Merged
zhongwencool merged 1 commit into
mainfrom
zw/local-pager-state
Sep 21, 2026
Merged

zhongwencool merged 1 commit into
mainfrom
zw/local-pager-state

Conversation

@zhongwencool

Copy link
Copy Markdown
Owner

Summary

  • Remove the single-consumer less_server gen_server and carry pagination state through the less_client loop instead.
  • Preserve pagination boundaries, keyboard/navigation precedence, headers, footers, whitespace, screen clearing, and return actions.
  • Replace process-protocol tests with frame-by-frame output regression coverage for real multi-page transitions, Unicode and empty lines, tiny terminals, geometry fallback, navigation, and exits.
  • Keep the change in one commit, scoped to four pager implementation/test files. No dependencies or unrelated documentation changes.

Compatibility

The CLI behavior and less_client:init/1 input forms remain unchanged. Initialization now returns local state rather than a PID-backed value; the internal less_server exports are removed without a compatibility wrapper.

Validation

  • rebar3 as test eunit --module=less_client_test: 44 tests passed.
  • rebar3 eunit: 797 tests passed.
  • rebar3 compile: passed.
  • rebar3 as ci compile: passed locally (not a claim of hosted CI completion).
  • git diff --check and git diff --cached --check: passed.
  • No remaining less_server references in production source or tests.

Real-terminal and -noshell raw-input validation were not run. The input path is unchanged; regression coverage uses the existing simulated I/O harness.

Changes:
- Replace the less_server process with local pagination state and pure page transitions in less_client.
- Preserve keyboard navigation, page boundaries, headers, footers, clearing, and exit behavior.
- Remove the process protocol tests and add frame-by-frame pagination, navigation, text boundary, and local-state coverage.

Validation:
- rebar3 as test eunit --module=less_client_test: 44 tests passed.
- rebar3 eunit: 797 tests passed.
- rebar3 compile and rebar3 as ci compile: passed.
- git diff --check and git diff --cached --check: passed.
- Real-terminal and -noshell raw-input validation were not run; this change leaves the input path unchanged and uses simulated I/O regression tests.
@codecov

codecov Bot commented Sep 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.91%. Comparing base (d67f72a) to head (505f836).

❌ Your project check has failed because the head coverage (97.91%) is below the target coverage (98.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #139      +/-   ##
==========================================
- Coverage   97.94%   97.91%   -0.03%     
==========================================
  Files          25       24       -1     
  Lines        7975     7928      -47     
==========================================
- Hits         7811     7763      -48     
- Misses        164      165       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The local-state implementation preserves existing pager semantics and is comprehensively covered by focused regression tests.

Review effort: Balanced
Findings: None

What changed in this PR

Moves pager state from a dedicated gen_server into the client loop while preserving behavior.

Changes:

  • Introduces local pagination state and navigation.
  • Removes less_server and its protocol tests.
  • Adds comprehensive frame-level regression coverage.
File Description
src/​less_client.erl Implements local pager state.
src/​less_server.erl Removes obsolete pager server.
test/​less_client_test.erl Adds pagination regression tests.
test/​less_server_test.erl Removes obsolete server tests.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@zhongwencool
zhongwencool merged commit 04aee9f into main Sep 21, 2026
18 of 21 checks passed
@zhongwencool
zhongwencool deleted the zw/local-pager-state branch September 21, 2026 16:52
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