LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to avoid auto scroll in Xterm (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-avoid-auto-scroll-in-xterm-836777/)

kamalp 10-07-2010 11:58 AM

How to avoid auto scroll in Xterm
 
Hi All,

I'm using Xterm. While running a prog/command if I scroll up and reading something on the screen, the xterm view resets to bottom if there is some output from the running command.

I tried enabling/disabling jump scroll, asynchronous scroll, scroll to bottom on tty output options of Xterm with no avail. In one way or the other way, the screen is scrolling or resetting to bottom if there is some output to screen.

I want to stop this behavior and the scroll should work as if it is in Konsole. The new output to screen should simply add at the bottom and the current viewing point should remain unscrolled. pls let me know if there is any working solution for this xterm problem.

Thanks a lot,
Kamal

bigrigdriver 10-07-2010 09:22 PM

Have you tried piping output of the app/script through less?

./some-script | less

That should hold at one screenfull, then press the spacebar for the next screenfull.

Use the up/down arrow keys to move up or down through the output.

kamalp 10-07-2010 11:22 PM

Hi bigrigdriver,

Thanks for the suggestion. But this does not serve my purpose unless I want to read the output from the command.
what if I want to read something already scrolled off which is the output of previous commands?

Is there any way to hold the xterm view?

Thanks,
Kamal

rustek 10-08-2010 03:11 PM

Control s
will stop it.

Control q
will restart it.

jcmlq 10-08-2010 04:35 PM

I don't think there is any way to do exactly what you are asking with xterm.

If you are looking to view the output of arbitrary commands during a session then you can turn on logging via the VT menu (ctl-button1) it will create a logfile named XtermLog.$random that you can tail -f or grep or paginate as you need.

You could also run the session inside the 'screen' program and have it create a logfile. Screen is also generally handy for dealing with terminals.

kamalp 10-08-2010 04:39 PM

Hi,

will Ctrl+S stops the command being running temporarily or it will stop the command output only but the command will be running in background and the output is buffered?

Thanks,
Kamal

rustek 10-08-2010 06:00 PM

I just remember it from the old days of terminals, it does not stop the program just the screen, it will buffer the output until the screen buffer overflows then you will start losing the output.

I use it while doing a tail -f so I can stop the screen output long enough to scroll up and read something that has gone past.

rustek 10-08-2010 06:25 PM

I just tested it and with tail -f and it works as I described.

But it appeared to suspend this script?

for counter in `seq 6001 6500`; do
echo $counter
sleep .01
done

So what it will do seems to depend on circumstance, so be aware of that.

Russ

kamalp 10-09-2010 01:30 AM

Hi Russ,

Thanks for the heads up. I found that Ctrl+S suspends the current running foreground command also.
workaround is while running the command add "&" so that it will run in background even if we press Ctrl+S. command will run in background, only output will be suspended from showing on the screen. this output is buffered and written to screen when you press Ctrl+Q.

But still,,, is there a perfect solution where we can hold the screen view in xterm while the command output simply adds at the end (just like in Konsole)??

Thanks,
Kamal

rustek 10-09-2010 02:15 AM

Possibly, but I don't know of it.

Sometimes just reducing the output can help a lot. eg.

command|grep -v "text1"|grep -v "text2" etc.

To remove any unneeded lines from the output.
Slows down the scrolling.

You obviously want to see this stuff in real time, and that's ok, but I usually don't bother, I just grep bits I want out of saved files or write a script to look for me and take action or email me depending on what it finds.

__PJ 01-20-2011 01:56 AM

You can do this a couple of ways. Either through your ~/.Xdefaults or ~/.Xdefaults-<hostname> depending on your OS, add the line:

XTerm*scrollttyoutput:false

Also add the following to jump to the bottom on keypress:

XTerm*ScrollTTYKeypress:true

Any time you modify this file, read it back in with xrdb ~/.Xdefaults

Alternatively, start xterm with -si -sk options. IE: xterm -si -sk

Ref: man xterm.

kamalp 01-21-2011 04:34 AM

Hi PJ,

Thanks for your reply. But none of this is helping. With your options, xterm viewpoint stays constant (scroll bar position) but the text keeps on scrolling.
These options behavior is not equal to Konsole.
In Konsole, text stays constant and scroll bar moves when new o/p adds to the screen. If the current text has to be moved out of Konsole history, then only text starts scrolling as scroll bar already reached top most position.

Thanks,
Kamal

__PJ 01-24-2011 02:42 AM

Hmmm, you're right. Perhaps I should test before posting. This has changed at some point; even downloading the latest xterm (267) and compiling doesn't work.

I have been playing with mrxvt also. If you're not locked into xterm, give it a go. It definitely has the desired effect and a few other niceties such as tabs, transparencies etc and is lightweight.

Here is a .mrxvtrc which should get you started. The only downside I've found so far is that copy to clipboard isn't implemented.

Mrxvt.scrollTtyKeypress: true
Mrxvt.scrollTtyOutputInhibit: true
Mrxvt.saveLines: 1000
Mrxvt.geometry: 120x40
Mrxvt.holdExit: false
Mrxvt.autohideTabbar: true
Mrxvt.background: white
Mrxvt.foreground: black
!Mrxvt.transparent: true
!Mrxvt.shading: 45
!Mrxvt.transparentTabbar: false
!Mrxvt.showMenu: false

kamalp 01-25-2011 06:32 AM

Hi PJ,

Thanks for your help.
I use copying to clipboard heavily. so I can't go for mrxvt.
I'm using Konsole for all my current purposes. The only downside of Konsole is that it is very slow in text scrolling compare to xterm.

Thanks,
Kamal


All times are GMT -5. The time now is 02:54 AM.