Skip to content

How about save/load terminal mode (altscreen state for htop,vim..) #23

@yurenchen000

Description

@yurenchen000

currently, when detach at htop/vim screen, will got a broken terminal.
//although leave htop run in detach state maybe not a good idea


demo

Maybe we can save the altscreen stat,
here is a demo
(with a patched dtach, which can restore from vim,htop which in altscreen)
(also a wrapper dtach.sh for convenience)

asciicast

principle

the key point is save term mode when detach, and restore it when attach.
https://terminalguide.namepad.de/mode/
especially ?1049 which indicate whether in altscreen
https://terminalguide.namepad.de/mode/p1049/

I didn't implement a full terminal sequence parser
(I think that's too heavy)


I just queried and saved from the terminal emulator
(Maybe it is not compatible with all terminal emulators and usage scenarios, but it is relatively lightweight)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions