Closed alephnull closed 4 years ago
I'm afraid I dont have the time to help you write a kitten. But basically you would write a UI less kitten that uses the as_text() method of the window object to get the text and save it to a file.
And when called in the restarted kitty, read the file and use window.paste_bytes()
I'm interested in writing a kitten for saving and restoring the scrollback buffer. I figured out how to save a window's buffer to a file, but not how to load the contents into a new window. I'm assuming I'd want to paste the bytes into the buffer before loading the shell, but I'm not sure how to do that in a kitten. Any pointers?
assuming you are saving it as ANSI text simply call window.write_to_child(test). If you want to do it before the child process runs, then use launch with --stdin-source
Apparently I was making that harder than I needed to. Calling launch
with a simple script that cats the saved state before execing the new shell seems to work.
#!/bin/zsh
cat $HOME/scrollback.txt
exec zsh
It is a shame to lose the buffer because a quick restart was needed.
If it is possible via a kitten, please do help me get started.