Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Is there any X terminal program, which reflows the content when I'm resizing the window? Gnome-terminal and Sakura does it well halfway: when I'm shrinking the window and re-expanding it, the stuff comes back to the right side of the screen as I want:

Opening a big window:

line 1 abcdefghijklmnopqrstuvwxyz       | right margin
line 2 abcdefghijklmnopqrstuvwxyz       | 

Shrinking it:

line 1 abcdefghijklm | right margin
line 2 abcdefghijklm |

Resizing to original (gnome-terminal, sakura), that's what I want to see:

line 1 abcdefghijklmnopqrstuvwxyz       | right margin
line 2 abcdefghijklmnopqrstuvwxyz       |

Resize to original (xterm, lxterm, PuTTY/win32), I don't like this:

line 1 abcdefghijklm                    | right margin
line 2 abcdefghijklm                    | 

That's okay, some terminals works well, others not. But when I'm opening a small window and expand it, all terminals works the same way: the lines remain wrapped at the left side, instead of re-flowing and re-wrapping:

Small window (line 1 and 2 just ran out of window):

line 3 abcdefghijklm | right margin
nopqrstuvwxyz        |
line 4 abcdefghijklm |
nopqrstuvwxyz        |

Resize to larger:

line 3 abcdefghijklm                    | right margin
nopqrstuvwxyz                           |
line 4 abcdefghijklm                    |
nopqrstuvwxyz                           |

What I want to see instead:

line 1 abcdefghijklmnopqrstuvwxyz       | right margin
line 2 abcdefghijklmnopqrstuvwxyz       |
line 3 abcdefghijklmnopqrstuvwxyz       |
line 4 abcdefghijklmnopqrstuvwxyz       |

Is there a chance to get this result? (I'm using Ubuntu with LXDE, if it matters).

share|improve this question
Argh, this feature has been removed from terminator: "We tried both this and Apple-like reflowing of text when you change the window size, and we decided we preferred this. Sadly, we don't have the resources to support two implementations, so reflowing is no longer an option; it's gone from the code." software.jessies.org/terminator –  ern0 Nov 17 '11 at 21:07
add comment

6 Answers

up vote 5 down vote accepted

Screen does what you want. It wraps lines while resizing the window.

sudo apt-get install screen


share|improve this answer
and it gracefully handles detaching from a terminal that's one size (80x24, say) and re-attaching from a terminal of another size (say, 132x50). –  Tim Kennedy Nov 18 '11 at 6:34
add comment

This is largely a function of the underlying application rather than the terminal program. Some applications will re-flow text correctly, others won't if they're not built to.

Normally an application (or terminal program such as xterm) will trap SIGWINCH and do some resizing accordingly. If your terminal program has already added line breaks to text when the text wraps it may not have retained enough information to know which lines to unwrap.

This is quite likely in the case of a terminal program as this would be sensible default behaviour. A terminal program can accept cursor movement commands, so a sequence of characters may not directly translate into lines with well understood line break charaters. It is probably not feasible for a terminal program to recall line breaks in the general case.

There may be other reasons as well. I expect that most if not all terminal programs will have this behaviour. At a guess, fixing this would require the terminal program to buffer the input stream and re-render its entire scroll buffer on a resize event. Post-hoc line wrapping is a much simpler problem.

Other programs (curses based editors, for example) will typically have an internal document structure independent of the display wrapping, so they retain enough information to reflow the text correctly.

share|improve this answer
The problem is clear, but it should be solved somehow. Say, there should be a virtual screen and a visible one. On the virtual screen the lines are unlimited long, and there is large line history, too. When resize occurs, this virtual screen should be re-rendered on the visible screen. Cursor movements (and all VT100 stuff) should be done a smart way: it may affect the virtual screen, but it should "take care" the actual visible screen's dimension. Not easy, but not impossible. –  ern0 Nov 17 '11 at 14:26
Computatioally difficult to intractable, I think. A terminal is cursor addressable, so the relationship between lines on the screen and characters output to the terminal is not as simple as just lines of characters. xterm is nearly 30 years old - somebody would have fixed it by now if it was (a) fixable and (b) a problem. –  ConcernedOfTunbridgeWells Nov 17 '11 at 16:52
This dude says that it works on Mac askubuntu.com/questions/66315/… –  ern0 Nov 17 '11 at 20:57
Well … this is related to the terminal program. If your application has only printed some text (eg: grep foo bar.txt), only the terminal knows what to do with the output once it exited –  Romuald Brunet Jul 8 '13 at 11:41
add comment

I too had been looking for something like this; I initially made all my terminals start with screen, which on the whole was what I was after.

However, sometimes having a shell nested inside screen isn't what you want, but you still need proper line wrapping - I've finally got fed up with this and as many of the terminals in the lubuntu repositories as I could and the only one I've found that does proper line-wrapping is rxvt-unicode - it's not the most attractive terminal in the world but it's extremely fast, and it works and finally has proper line wrapping on resize :)

Also, with a fair amount of fiddling with .Xdefaults you can make it look at least less ugly!

Edit: in fact, this post: http://crunchbanglinux.org/wiki/urxvt has some simple instructions to make rxvt look almost like a recent terminal. Problem solved :)

share|improve this answer
add comment

Just checked konsole from KDE. It works as you want.

share|improve this answer
Does not seem to be the case (Konsole 2.8.5) –  Romuald Brunet Jul 8 '13 at 11:48
add comment

The new beta terminal emulator called FinalTerm has support for this.

It's one of the main advertised features on their website.

Please note that this terminal is still in heavy development, and is probably not suited for day to day use.

share|improve this answer
add comment

VTE supports this starting from version 0.35 (this is the actual terminal engine behind Gnome-Terminal and Sakura).

share|improve this answer
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.