Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 316981 - [terminal] scroll lock fails when the terminal buffer runs over
Summary: [terminal] scroll lock fails when the terminal buffer runs over
Status: NEW
Alias: None
Product: CDT
Classification: Tools
Component: terminal (show other bugs)
Version: Next   Edit
Hardware: All All
: P3 minor (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Jonah Graham CLA
URL:
Whiteboard:
Keywords:
Depends on: 205486
Blocks:
  Show dependency tree
 
Reported: 2010-06-15 17:15 EDT by Martin Oberhuber CLA
Modified: 2020-09-04 15:12 EDT (History)
7 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Oberhuber CLA 2010-06-15 17:15:22 EDT
CQ:WIND00215180

We have found an understandable but unexpected issue with the scroll lock
feature, by exposing it via SSH to the following shell script:

#!/bin/sh
X=1
while true ; do
  X=`expr $X + 1`
  echo "Hello $X"
done

Running this script, the "scroll lock" feature does not work - - the problem
with the test case is that new lines are printed so quickly, that the Terminal
Widget's buffer runs over.

Fix:
Window > Preferences > Terminal : Set "Terminal Buffer" to 100000 lines

Now, scroll lock works as expected even with this case (until 100000 lines are
reached). The point is that when the terminal buffer size is exhausted, new
lines are being added to the buffer and removed at its beginning, since we have
a ring buffer. As a consequence, the "locked scroll location" always remains at
the same place while the buffer under it gets rotated.

Is this expected behavior, or should the scroll lock position rotate with its
underlying source line when the buffer runs over ... up until the time when the
"locked line" is expelled from the buffer? 

What do others think?
Comment 1 Michael Scharf CLA 2010-06-16 13:45:33 EDT
I think the scroll-lock position should move until it disappears.

At some point I have been considering to implement a persistent ITerminalTextData.
It would store the content of the teriminal that is scrolled away into a temp file. Since lines outside the dimensions of the editable area of the terminal can not change, this should be relatively simple. One could automatically use a PersistentTerminalTextData when scroll lock is enabled. The advantage would be that the lines you are looking at would never disappear (at the cost of a ever growing temp file).
Comment 2 arne anka CLA 2010-09-16 09:16:44 EDT
it is definitel not "expected behaviour" and it is a very old bug, that seems to never getting fixed.
i've seen it in all eclipse versions from at least 3.0 and opened at least one bug report against it which seems to have disappeared.

scroll lock means: do not change the content displayed.
Comment 3 Michael Scharf CLA 2010-09-16 15:19:06 EDT
My definition of "scroll-lock": when new data arrives, do not jump to the end of the file.

The Console View in eclipse does the same.

Do you know other terminals that keeps an infinite history?
Comment 4 arne anka CLA 2010-09-16 15:47:14 EDT
a) what does the "infinite history" to do with it?
b) the only definition  of scroll lock i know is: don't change the visible content.

if the console displays a number of rows and i hit "scroll lock", i expect the console to display exactly the lines i locked, not scrolling anyway -- any kind of scrolling means it's broken, no matter why it happens.

how that is accomplished, doesn't concern me (but, in fact, i would prefer to have a file buffering the content, not just a ring buffer in memory, which would be broken by design with respect to the issue at hand. after all, eclipse produces several temporary and persistent files, logs and other, why not saving the console's content to yet another, at least in case of scroll lock?).
Comment 5 Michael Scharf CLA 2010-09-16 21:45:09 EDT
> b) the only definition  of scroll lock i know is: don't change the visible
content.

By that definition the eclipse console view is definitely broken.

If the definition is:
  1) show the content that is currently visible (until it falls out of the buffer)

then the Console View is not broken, but the terminal is broken.


A better definition could be: 
  2) stop updating the view (and buffer the incoming data)

With that definition, the data would still be received but it would not be displayed. When the scroll-lock is released then all the pending data is played.
This could also be seen as "take a snapshot of the current state".


The ultimate definition would be:
  3) stop (auto) scrolling and "infinitely" grow the buffer of visible content

This would allow also to scroll to data that was appended after you press the scroll-lock button.

I would consider 3) the ultimate solution. But is is relatively expensive to implement, because that would require to store the content of the visible (growing buffer) on disk. The problem here that text and the styles would
have to be stored.

Solution 2) is much simpler to implement. Because it would only require to buffer the incoming data in a file and then replay it once the scroll-lock state is switched off.

Would definition 2) satisfy your needs?
Comment 6 arne anka CLA 2010-09-17 03:13:22 EDT
#2 is fully sufficient.
as long as the buffer is accessible by a well defined and easily memorized procedure, "scroll lock" could (should?) mean even locking manual scrolling.

#3 seems totally out of reach, after all the current solution apparently was supposed to do that exactly -- and failed.
Comment 7 Martin Oberhuber CLA 2010-09-17 03:39:14 EDT
With all that discussion about buffering I'm wondering ... is the terminal forced to consume all the data that comes in from the remote?

Serial, Telnet, SSH ... all support flow control. So when the Terminal doesn't consume any output any more, the remote could be blocked from producing more output. That's how the Ctrl+S / Ctrl+Q keys work on a typical UNIX-a-like. Or am I missing something ?
Comment 8 Jonah Graham CLA 2020-05-01 10:09:49 EDT
The Terminal component of the Eclipse Ecosystem has a new home. The Terminal is now part of the Eclipse CDT project[1].

This change means a new Git repo[2], P2 site[3] and Bugzilla component. The terminal will continue to be delivered as part of the quarterly Simultaneous Release of Eclipse as well.

The marketplace entry[4] had not been updated in a few years. It will once again install the latest release of the terminal on the latest release of the whole IDE (currently 2020-03).

If this bug is no longer relevant, please feel free to comment or close the bug. If you can confirm if this issues still occurs in the latest release please do let me know in a comment.

[1] https://wiki.eclipse.org/CDT/User/NewIn911
[2] https://git.eclipse.org/c/cdt/org.eclipse.cdt.git (in the terminal directory)
[3] current release is 9.11 - P2 site https://download.eclipse.org/tools/cdt/releases/9.11/
[4] https://marketplace.eclipse.org/content/tm-terminal

(This comment was added to all open terminal bugs along with changing the Product/component pair to CDT/terminal.)