Skip to content

Option to preserve alternate screen buffer content in scrollback on exit #2837

@JustHereToHelp

Description

@JustHereToHelp

I've tried every terminal out there and Wave is the best by far, with so much potential — I'm excited to see new features roll out. Which is why this one gap bugs me.

I run a lot of long-running interactive CLI sessions in Wave, and every time I exit one, the entire output vanishes from my terminal. I can't scroll up to reference what was discussed or copy a command that was suggested.

This doesn't happen with normal terminal commands — I can scroll up through hours of git log, grep output, whatever. But any TUI app (vim, htop, lazygit, interactive REPLs) that uses the alternate screen buffer just disappears completely when it exits.

Other terminals have options for this:

  • iTerm2 has "Save lines to scrollback when an app status bar is present"
  • xterm has the titeInhibit resource
  • Kitty has similar toggles for alternate screen scrollback

Wave doesn't have anything like this. When rmcup fires, the alt buffer content is just gone.

What I'd love is a config option, something like:

term:preservealtscreen = true

The behavior would be: when a TUI app exits the alternate screen, snapshot whatever was visible and append it to the normal scrollback before switching back. That way I can scroll up and still see my interactive session, the file I was editing in vim, etc.

I'm not asking for scrollback while in the alt screen (that's a bigger lift) — just preserving the final visible content when the app exits. Plain text would be fine to start, styled output would be a bonus.

For context, I looked into this a bit — xterm.js doesn't support it natively, but it should be doable by hooking the parser for DECRST ?47/?1047/?1049, snapshotting the alt buffer via the buffer API, and injecting it into the main scrollback after the switch. The SerializeAddon could help with capturing styled content.

Environment:

  • macOS (Apple Silicon)
  • Wave v0.13.1
  • Heavy TUI usage: vim, htop, lazygit, interactive CLI tools

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions