selectel / pyte

Simple VTXXX-compatible linux terminal emulator
http://pyte.readthedocs.org/
GNU Lesser General Public License v3.0
653 stars 101 forks source link

History preservation on resize #31

Open thomasballinger opened 10 years ago

thomasballinger commented 10 years ago

I'm subclassing HistoryScreen to have history added when the terminal gets smaller - is this something that might belong in pyte?

superbobry commented 10 years ago

Can you show a demo of how this works? Do you plan to support the complementary transformation, i.e. when the terminal gets larger.

jonathanslenders commented 10 years ago

Have a look at how tmux reflows text when the size changes. Actually, it doesn't change anything to the screen data structure (in order to revert), but the renderer can split a line of the screen over several lines, if at some point the window gets smaller.

I think the scrolling logic at that point gets complicated, especially with support for double-width characters.

jonathanslenders commented 10 years ago

If reflow (autowrap) is too complicated, you can also just hide what doesn't fit in the amount of columns, and show it again when the window is enlarged.

thomasballinger commented 10 years ago

Since I'm trying to imitate xterm, I was planning to support the opposite, but not do any linewrap. I'm also looking into how to test linewrap because I'm working on a tool that needs to be tested with various terminal resizing behaviors, but for now was planning to use pyte only for testing xterm-like behavior. I have a feeling I'm going to end up scraping the output of real terminal emulators via an accessibility protocol or similar eventually.

If the window got taller, lines would be take out of history and placed at the top of the screen.

devxpy commented 5 years ago

Text reflow would be very cool to have.