Question

Say I have an Emacs window (i.e. a subdivision of what Emacs calls a frame) running an M-x ansi-term buffer (e.g. running zsh) with that is ~500 pixels wide. I then run several shell commands and the output is wrapped to fit within those 500 pixels.

Say that I now make this window or buffer wider (e.g. 1000 pixels), maybe because I kill other windows in the frame, giving more space to my ansi-term window.

Is there any way to get older output in my ansi-term window to resize to take advantage of the new window size? (i.e. making lines wider and re-wrapping them according to the new window size)?

Was it helpful?

Solution

No, not usually, because the program that produced the output (may have) formatted itself to fit the width of the display that was in effect at the time of its printing, and is no longer running when you resize.

However, if it is still running, it goes get the option to resize itself (a SIGWINCH). You might test this with e.g. the links/elinks browser. This is the real “use case” for ANSI terminal mode: programs that use “curses” or similar systems to move the cursor around.

As @user2491 pointed out, shell-mode does handle text-based (stream-based) output with word-wrapping, at the penalty of not being able to run “curses”-type programs. It's designed to treat your session a bit more like a text file, and less like a “real terminal.”

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top