Horizontal scroll in a bash window
Asked Answered
E

3

8

I used printf to output a columnar display of a text file.

However the length I wanted will cause the columns to flow into the next line.

I've been searching for a flag or workaround that will make the console window scroll and could only come across the following:

set horizontal-scroll-mode On

It's right under the #! /bin/bash line, but couldn't work

Is there another way?

Eve answered 29/1, 2010 at 16:53 Comment(1)
The horizontal-scroll-mode setting is for readline input rather than echo or printf output. It won't do what you want. If you were to set it, you would add that line in your inputrc file (or in a script or at the command line you'd do bind "set horizontal-scroll-mode On" instead).Ventre
M
1

Maybe you should look into using dialog, here's the man page for dialog, or ncurses to do this for you instead of wrestling with the means of outputting text and scrolling. Let those libraries take care of that for you.

Hope this helps, Best regards, Tom.

Mira answered 29/1, 2010 at 16:56 Comment(0)
V
21

No. Terminals are not designed to scroll horizontally. Use less -S to allow scrolling left and right as well as up and down.

Vallievalliere answered 29/1, 2010 at 16:55 Comment(1)
I don't know who gave you the "drive-by downvote", but your answer helped me! It took me a few seconds to realize that I had to use the arrow keys to move left and right (instead of h and l).Lymphatic
M
1

Maybe you should look into using dialog, here's the man page for dialog, or ncurses to do this for you instead of wrestling with the means of outputting text and scrolling. Let those libraries take care of that for you.

Hope this helps, Best regards, Tom.

Mira answered 29/1, 2010 at 16:56 Comment(0)
S
0

My answer to you is not that good. But it worked for me. Use python/tk or perl/tk or whatever/tk. output the text to a text box with horizontal and vertical bars.
I have this 3 text boxes.

  1. the commands I run.
  2. the output of the commands
  3. oh... the commands to make the commands I run.
    But this is a utility only for me.
Shriek answered 26/4, 2023 at 19:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.