Skip to content

vxfw: add opt-in primary-screen history mode (preserve terminal scrollback)#310

Open
Fristender wants to merge 1 commit intorockorager:mainfrom
Fristender:feat/opt-in-primary-screen-history
Open

vxfw: add opt-in primary-screen history mode (preserve terminal scrollback)#310
Fristender wants to merge 1 commit intorockorager:mainfrom
Fristender:feat/opt-in-primary-screen-history

Conversation

@Fristender
Copy link

Summary

This PR adds an opt-in mode for vxfw.App that runs in the primary screen and preserves terminal scrollback/history, while keeping default libvaxis behavior unchanged.

What changed

  • Added vxfw.App.Options.primary_screen_history: bool = false

    • Default remains existing behavior (alternate screen + existing interaction model).
    • When true, app runs in primary screen and preserves history.
  • Wired vxfw.App.run to:

    • Use alt screen only when primary_screen_history == false.
    • Set vx.opts.preserve_screen_on_exit based on the new option.
    • Ensure an initial winsize is applied before first layout/render.
    • Reserve terminal space in primary-screen mode so prior shell output is retained above the app.
    • Trigger an initial redraw on startup.
  • Updated Vaxis behavior to support preservation:

    • Added Vaxis.Options.preserve_screen_on_exit (default false).
    • In resetState, when preservation is enabled on primary screen, avoid clearing the frame and move to a new line.
    • In resize, avoid erasing below cursor in preserved primary-screen mode.

Behavior

  • Default (.primary_screen_history = false): unchanged from current libvaxis defaults.
  • Opt-in (.primary_screen_history = true):
    • Previous terminal output remains in scroll history.
    • Final TUI frame remains visible in history after exit.

Notes

Mouse capture/input policy changes are intentionally not included in this PR.

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.

1 participant