"Disable Scroll-Forward" doesn't account for page-up/page-down keys #10471

Closed
opened 2026-01-31 02:22:23 +00:00 by claunia · 1 comment
Owner

Originally created by @carlreinke on GitHub (Sep 2, 2020).

Environment

Windows build number: 10.0.19041.0

Steps to reproduce

  1. Start PowerShell in conhost.
  2. Enable "Disable Scroll-Forward".
  3. Run a command that produces multiple screens of output.
  4. Use the page-up key to scroll to the top of the output.
  5. Use the page-down key to scroll past the output.

Expected behavior

Scrolling it limited to the output and the scrollbar lets you scroll the output.

Actual behavior

After running command, scrollbar is as expected:
image

After page-up key once, scrollbar is indeterminate:
image

After page-up key again, scrollbar indicates that you see all the output (but you don't):
image

After page-down key, you have scrolled past the end of the output:
image

Originally created by @carlreinke on GitHub (Sep 2, 2020). # Environment Windows build number: 10.0.19041.0 # Steps to reproduce 1. Start PowerShell in conhost. 1. Enable "Disable Scroll-Forward". 1. Run a command that produces multiple screens of output. 1. Use the page-up key to scroll to the top of the output. 1. Use the page-down key to scroll past the output. # Expected behavior Scrolling it limited to the output and the scrollbar lets you scroll the output. # Actual behavior After running command, scrollbar is as expected: ![image](https://user-images.githubusercontent.com/11667451/92039310-1aae4e00-ed32-11ea-81d2-0893d2d913ed.png) After page-up key once, scrollbar is indeterminate: ![image](https://user-images.githubusercontent.com/11667451/92039360-2c8ff100-ed32-11ea-9507-92a3cd5103b2.png) After page-up key again, scrollbar indicates that you see all the output (but you don't): ![image](https://user-images.githubusercontent.com/11667451/92039398-39144980-ed32-11ea-8289-39689beb257d.png) After page-down key, you have scrolled past the end of the output: ![image](https://user-images.githubusercontent.com/11667451/92039443-4c271980-ed32-11ea-9d06-4e268c9d8717.png)
claunia added the Resolution-By-DesignNeeds-Tag-Fix labels 2026-01-31 02:22:24 +00:00
Author
Owner

@DHowett commented on GitHub (Sep 2, 2020):

So I've got some unfortunate news!

PowerShell (specifically PSReadline) has implemented its own handling for PgUp/PgDown:

PS C:\Users\duhowett> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.19041.1
...
BuildVersion                   10.0.19041.1
...

PS C:\Users\duhowett> Get-PSReadLineKeyHandler | ? Key -Like "*Page*"

Miscellaneous functions
=======================
Key           Function              Description
---           --------              -----------
PageDown      ScrollDisplayDown     Scroll the display down one screen
Ctrl+PageDown ScrollDisplayDownLine Scroll the display down one line
PageUp        ScrollDisplayUp       Scroll the display up one screen
Ctrl+PageUp   ScrollDisplayUpLine   Scroll the display up one line

In these handlers (code here), they're directly manipulating the console screen buffer.

Because they're setting the actual active viewport using these APIs, there's nothing we can really do but listen to them. If they want to scroll the viewport into the unpopulated region below the virtual bottom, they're fully allowed to do so.

Resolution on this one is, regrettable, "by design" -- we have to support these APIs forever, even if they coincide with our experimental features in an unfortunate way.

@DHowett commented on GitHub (Sep 2, 2020): So I've got some unfortunate news! PowerShell (specifically PSReadline) has implemented its own handling for <kbd>PgUp</kbd>/<kbd>PgDown</kbd>: ``` PS C:\Users\duhowett> $PSVersionTable Name Value ---- ----- PSVersion 5.1.19041.1 ... BuildVersion 10.0.19041.1 ... PS C:\Users\duhowett> Get-PSReadLineKeyHandler | ? Key -Like "*Page*" Miscellaneous functions ======================= Key Function Description --- -------- ----------- PageDown ScrollDisplayDown Scroll the display down one screen Ctrl+PageDown ScrollDisplayDownLine Scroll the display down one line PageUp ScrollDisplayUp Scroll the display up one screen Ctrl+PageUp ScrollDisplayUpLine Scroll the display up one line ``` In these handlers (code [here](https://github.com/PowerShell/PSReadLine/blob/a88c22fd60a69f41d1b727b7c51b5cbf8f9b5f68/PSReadLine/Render.cs#L1263-L1288)), they're directly manipulating the console screen buffer. Because they're setting the actual active viewport using these APIs, there's nothing we can really do but listen to them. If they want to scroll the viewport into the unpopulated region below the virtual bottom, they're fully allowed to do so. Resolution on this one is, regrettable, "by design" -- we have to support these APIs forever, even if they coincide with our experimental features in an unfortunate way.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#10471