Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop scrolling to the bottom while echoing something if I am trying to scroll up #318

Open
rhymdsadeelf opened this issue Feb 20, 2016 · 9 comments

Comments

@rhymdsadeelf
Copy link

Try echoing the content of a very big file. The scroll bar keeps scrolling to the button to the latest line, even if you try to scroll up.

Many programs stop trying to continue to scroll to the latest line if user is trying to scroll to an above line to read something.

@cbucher
Copy link
Owner

cbucher commented Feb 26, 2016

Hi,
There is a scroll lock key on your keyboard. This is the role of this key.

@rhymdsadeelf
Copy link
Author

There is no Scroll lock key on many keyboard these days. Beside I tried On-Screen Keyboard. Scroll lock doesn't seems to be doing what I am suggesting. When something is echoing, it always try to jump on last line, even if I try to scroll up

@cbucher
Copy link
Owner

cbucher commented Feb 29, 2016

Yes, you're right.
In my time:

While not often used today, the scroll lock key was originally intended to be used in conjunction with the arrow keys to scroll through the contents of a text box. It has also been used to stop the scrolling of text ...

Now, the scroll command is no longer associated to scroll lock key in Windows console...

@cbucher
Copy link
Owner

cbucher commented Nov 20, 2016

@rhymdsadeelf
Sorry for the long time.
You can use "Stop scrolling" command and then scroll up.

There are some possible improvements:

  • Automatically send the "stop scrolling" command when you scroll up (I can only detect scrolling with the scroll bar)
  • Automatically send the "stop scrolling" command when you press the scroll lock key (entering scroll mode)
  • Automatically send the "resume scrolling" command when you scroll down to the cursor (I can only detect scrolling with the scroll bar)
  • Automatically send the "resume scrolling" command when you press the scroll lock key (exiting scroll mode)
  • Add a checkbox in settings/behavior to activate this behavior

What do you think about these improvements?

@rhymdsadeelf
Copy link
Author

Sounds perfect to me :)

@ankostis
Copy link

ankostis commented May 28, 2017

Dear @cbucher actually don't bother with the settings-checkbox - really that behavior would be just fine for the default.

@ankostis
Copy link

In the above events, I would wait for the user to [Mouse Up] to detect if scroll needs enable/disable, so that visiting last line while dragging scrollbar does not disable scrollock.

An issue is that since the bottom of scroll-buffer is not where the last line has been printed but further down the window, depending on the buffer-lines set. So it should be kind of difficult to locate where the last line is, and maybe the user has a hard time to disable the scroll-lock with the scrollbar, no?

Another feature common among programs implementing this auto-scroll-lock functionality is to have a notification icon signalling when new input has been printed at the bottom.
A feature worth going into the settings is to revert to bottom-line when something gets printed in STDERR, if you have this capability. So there is 2 levels of auto-scroll-lock: ignore STDOUT, and ignore both STDOUT + STDERR. Maybe an icon ob the toolbar would be much more useful for such features.

@cbucher
Copy link
Owner

cbucher commented May 31, 2017

ConsoleZ reads the console buffer.
Reading STDERR or STDOUT implies creating pipes to redirect STDOUT or STDERR. Unfortunately, when default console handles are replaced by pipes, applications can no longer write text with color.

When Windows console is in "mark" state (scroll-lock), console application cannot output text (execution is blocked in output text functions until "mark" state is disabled).

Actually the console hook reads the text located in screen buffer window. This window automatically follows the cursor. When we scroll, we modify the position of this window (SetConsoleWindowInfo). But every time the cursor position changes, the window returns to the cursor position.
We can try to manage an alternate window position to simulate scroll-lock.
We can stop scroll lock when alternate window Y-position is higher than real window Y-position.

@rshivane
Copy link

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants