LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Slow scrolling (https://www.linuxquestions.org/questions/slackware-14/slow-scrolling-4175481949/)

waddles 10-24-2013 12:13 AM

Slow scrolling
 
I used to be able to automatically scroll a scroll region under a different OS. I tried those escape commands but everyone fails.
Other than doing a where/read line and sleep to display a line are there any shell escape commands or anything to do this automatically?
Is there a way to create a scroll region with bash? I can do it with that where/read and carefully setting margins but am looking for a simpler approach maybe like scrollreg x,y x1,y1?

cisneros 10-24-2013 12:53 AM

i lost you in "scroll a scroll", please explain it with more examples and details.

TracyTiger 10-24-2013 12:54 AM

Sounds like a bash programming question, not a Slackware specific topic.

Perhaps you're asking about a terminal configuration setting in Slackware?

waddles 10-24-2013 03:16 AM

@cisneros: I am looking for escape commands to use in bash/bourne shell scripting that allow for automatic scrolling of text within a defined scroll region.
My fall back method is without defining a region within which to display:
Code:

while read line
do
  echo $line
  sleep 2s
done < ThisOrOtherFile

@Tracy Tiger: not quite. It would be use of escape commands or tput commands (maybe) that limit text to within an area of the current screen. Kinda like a split-screen only split horizontally. It might take a terminal redef but if so I don't know which commands it might be. It could be a use of tput to extract a feature form the terminal definition.
@

waddles 10-30-2013 10:27 AM

Actually it is a bit of both bash and terminal.
What I had done was to tell the system/terminal that lines say 15 to 20 would be set aside to output to and whatever file I catted or listed would output only within those lines. It looks like tput csr is close but cannot get it to set aside a scroll area. Hope this helps someone to come up with a genius idea.

phoemur 10-31-2013 04:29 PM

How about this:

Quote:

less << EOF
bla
bla
bla
bla
bla
your
text
here
...
...
...
EOF
Then you'll be able to scroll up and down the whole text using the arrow keys, press q to quit...

phoemur 10-31-2013 04:42 PM

Suppose you have a file.txt to scroll along a small portion of your screen, in the example between lines 10 and 30, I made this:

Code:

#!/bin/bash

n=1
last=$(wc -l < file.txt)
sup_margin=10
inf_margin=30

for i in $(seq 1 $last); do
    tput cup $sup_margin 0
    sed -n "$n,$((n+$inf_margin))p" file.txt
    sleep 1
    let n++
    clear
done
tput sgr0


phoemur 10-31-2013 04:58 PM

Another one with tput csr, scrolling file.txt

Code:

#!/bin/bash

clear
tput csr 10 30
tput cup 10 0

exec 3< file.txt
while read LINE <&3; do
  echo "$LINE"
  sleep 1
done
exec 3<&-

tput reset



All times are GMT -5. The time now is 09:31 PM.