tags:

views:

44

answers:

1

In linux, when a terminal (like xterm) gets resized to something smaller, then expanded again, its output history gets truncated to whatever the smaller width was. Does anybody know how to make the terminal remember its previous state, or wrap text so that this doesn't break?

For example, if your terminal reads something like (using | to indicate the window edge):

|user@machine$ cat file          |
|file contents foobar blah blah  |
|fooblah blah                    |

And the terminal is resized to, say 6 characters, it looks like this:

|user@m|
|file c|
|foobla|

Then putting the width back to what it was before gives:

|user@m                          |
|file c                          |
|foobla                          |

This can get pretty irritating when it means you lose useful console output. Does anybody have a solution?

+1  A: 

This is one of many annoyances that led to me to write my own shell/terminal replacement gush. I use a Tk text widget for output text, which resizes sensibly and can also be switched between line-wrapping on characters or words or left-right scrolling for long lines.

Colin Macleod
Thanks. I've actually just finished looking at urxvt, which also fixes up this issue.
Nicolas Wu