Horizontal Scrolling in Terminal
What you're asking is a terminal of infinite width, a portion of which is being displayed. It's not how terminals traditionally work nor how applications expect them to work.
For instance, if the terminal has infinite width, how are visual applications meant to work when they want to display something in the middle of the screen?
Something approaching that you can do though is use GNU screen
(you're supposed to be able to attach a screen session from several terminals of different sizes so screen knows how to display a small window of a larger terminal) and set the screen
windows width to something very large and then trick visual applications into thinking that the screen width is the original one.
Like (within screen
)
c=$COLUMNS # assuming your shell has that variable
screen -X width -w 1000
stty cols "$c"
Some visual applications will work fine, some not so well (for install when they do relative positioning or when they rely on the terminal wrapping). vim
seems to work OK.
Then to scroll and copy paste data, the only option is to use screen
's copy mode. (<prefix>]
) and move around the cursor (see info -f screen -n Movement
for moving around in copy mode).
tmux
may have similar capabilities.
This terminator
terminal emulator (java based), which is not the terminator
that comes with ubuntu also does just that with an infinite terminal width:
- lines are never wrapped
- visual applications are told the screen width is whatever fits in the window, not infinity.
- it would also work better than the
screen
based solution above in that its terminfo entry claims it doesn't do line wrap so applications are aware of that, and BS at the start of the line doesn't move to end of the previous line.
While Emacs is primarily an editor and IDE¹, it happens to match your problem very well. You can run a program inside an Emacs window, and Emacs displays it in a dumb terminal of infinite width and height. If the cursor is at the end of the buffer, the window will scroll as the program produces output; if you move the cursor around, the window will stay put as the output grows.
Type M-x shell RET
(i.e. Alt+x shell
Return) to start a shell in an Emacs buffer. Type C-u M-x shell RET
or M-1 M-x shell RET
to start another shell. You can run a program in each shell and arrange the buffers in multiple windows as you wish.
¹ It is sometimes said to be a better OS than editor, but only by people who don't use it — that's just a joke.