Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
added 390 characters in body
Source Link
Pierre Carrier
  • 2.6k
  • 20
  • 28

Yes, inIn the general case, you need to replay in a terminal of the same size.

You could store it along with your transcript and recreate the correct size when replaying (xterm -geometry [...] -e [...]), but that won't support resizing.

As mentioned by sendmoreinfo, you could declare a TERM that doesn't support any of these features.

If you care a lot about this, you could have your ttyrec record the terminal size and its changes by handling the SIGWINCH signal and using ioctl(STDIN_FILENO, TIOCGWINSZ, [...]). The harder part is then to correctly replay. I'll get back to you on this.

  • You can decide to ignore it altogether. As mentioned by sendmoreinfo, you could declare a TERM that doesn't support any of these features. Don't expect vim or readline to behave in the nice ways you got used to, though.

  • You could store it along with your transcript and recreate the correct size when replaying (eg xterm -geometry [...] -e [...]), but resizing will break everything.

  • If you care a lot about this and want the perfect solution, you could implement it yourself!

    • You could have your ttyrec record the terminal size and its changes by handling the SIGWINCH signal and using ioctl(STDIN_FILENO, TIOCGWINSZ, [...]).

    • Your ttyplay would have to take care of emulating a terminal itself, and representing it within a terminal. That's tricky, but luckily there are a few projects already doing that, so you could reuse a well-established codebase. tmux comes to mind, for example.

Yes, in the general case you need to replay in a terminal of the same size.

You could store it along with your transcript and recreate the correct size when replaying (xterm -geometry [...] -e [...]), but that won't support resizing.

As mentioned by sendmoreinfo, you could declare a TERM that doesn't support any of these features.

If you care a lot about this, you could have your ttyrec record the terminal size and its changes by handling the SIGWINCH signal and using ioctl(STDIN_FILENO, TIOCGWINSZ, [...]). The harder part is then to correctly replay. I'll get back to you on this.

In the general case, you need to replay in a terminal of the same size.

  • You can decide to ignore it altogether. As mentioned by sendmoreinfo, you could declare a TERM that doesn't support any of these features. Don't expect vim or readline to behave in the nice ways you got used to, though.

  • You could store it along with your transcript and recreate the correct size when replaying (eg xterm -geometry [...] -e [...]), but resizing will break everything.

  • If you care a lot about this and want the perfect solution, you could implement it yourself!

    • You could have your ttyrec record the terminal size and its changes by handling the SIGWINCH signal and using ioctl(STDIN_FILENO, TIOCGWINSZ, [...]).

    • Your ttyplay would have to take care of emulating a terminal itself, and representing it within a terminal. That's tricky, but luckily there are a few projects already doing that, so you could reuse a well-established codebase. tmux comes to mind, for example.

Source Link
Pierre Carrier
  • 2.6k
  • 20
  • 28

Yes, in the general case you need to replay in a terminal of the same size.

You could store it along with your transcript and recreate the correct size when replaying (xterm -geometry [...] -e [...]), but that won't support resizing.

As mentioned by sendmoreinfo, you could declare a TERM that doesn't support any of these features.

If you care a lot about this, you could have your ttyrec record the terminal size and its changes by handling the SIGWINCH signal and using ioctl(STDIN_FILENO, TIOCGWINSZ, [...]). The harder part is then to correctly replay. I'll get back to you on this.