Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I've been trying to figure this out -- the goal is to scroll horizontally in GNU Screen. (In order to avoid ugly line wrap in the result of CLI mysql queries.)

If you do:

screen -h 5000 # 5000 lines history
Ctrl-a r # to disable horizontal wrap
mysql -u user -p
SELECT * FROM db.big_fat_table LIMIT 500;
Ctrl-a [ # to enter scroll (copy) mode

Now you can scroll up and down with Ctrl-b and Ctrl-d, respectively. But how do you scroll right and left?

share|improve this question

migrated from stackoverflow.com Aug 9 '10 at 2:15

This question came from our site for professional and enthusiast programmers.

add comment

2 Answers 2

I don't think turning the wrap option off does what you think it does. Here's what my man page shows for the wrap option:

wrap [on|off]

Sets  the  line-wrap setting for the current window.  When line-wrap is
on, the second consecutive printable character output at the last  col-
umn  of  a  line  will  wrap to the start of the following line.  As an
added feature, backspace (^H) will also wrap through the left margin to
the previous line.  Default is ‘on’.

This is a low-level terminal feature and isn't related to horizontal scrolling.

However, less has a feature that might help you, the -S switch allows you to scroll left and right within a file using the left and right arrow keys. If you're viewing a result file with long lines, this can be very useful.

share|improve this answer
add comment

As far as I know screen doesn't do horizontal scrolling. Screen mostly emulates a hardware terminal, and horizontal scrolling is not a typical feature of hardware terminals.

You could run your queries in a M-x shell buffer in Emacs. The truncate-lines variable controls whether long lines are wrapped or not. When long lines are not wrapped, Ctrl+PgUp or Ctrl+x,< scrolls left and Ctrl+PgDn or Ctrl+x,> scrolls right.

share|improve this answer
add comment

Your Answer

 
discard

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