Console selection via arrow keys doesn't work when code is multiple pages/scrollable #12538

Closed
opened 2026-01-31 03:18:16 +00:00 by claunia · 3 comments
Owner

Originally created by @nkasco on GitHub (Feb 12, 2021).

Regardless of your window size (maximized or any other size) you cannot use the left arrow key to move the input cursor to the beginning of the pipeline. It appears to be bound to the first visible line within your current window size.

Powershell 5, not sure if happens on other consoles.

Example: Paste a multi-lined function into Windows Terminal and hit left arrow (or ctl+left arrow) and you will get an audible beep noise when it cannot scroll back further.

Expected behavior: Should be able to go back to the beginning of your command, not being stuck at the window bound. This works properly from a regular Windows PowerShell window.

image
(Cannot left arrow past the top line)

Originally created by @nkasco on GitHub (Feb 12, 2021). Regardless of your window size (maximized or any other size) you cannot use the left arrow key to move the input cursor to the beginning of the pipeline. It appears to be bound to the first visible line within your current window size. Powershell 5, not sure if happens on other consoles. Example: Paste a multi-lined function into Windows Terminal and hit left arrow (or ctl+left arrow) and you will get an audible beep noise when it cannot scroll back further. Expected behavior: Should be able to go back to the beginning of your command, not being stuck at the window bound. This works properly from a regular Windows PowerShell window. ![image](https://user-images.githubusercontent.com/1930697/107783372-2efe6a00-6d18-11eb-8676-b181d02500af.png) (Cannot left arrow past the top line)
Author
Owner

@zadjii-msft commented on GitHub (Feb 12, 2021):

Does this work on Powershell 7?

This sounds like an issue exacerbated by conpty's buffer being exclusively the size of the terminal window. Probably repros in regular old conhost if you set the buffer height to the viewport height. Sounds like they're not gracefully handling the case where the command takes more lines than the height of the entire buffer.

That being said this would probably also repro with any other terminal emulator too. Hence why I'm thinking this might be fixed in newer versions of powershell. Since newer versions of powershell need to run on other platforms, maybe they found a way to gracefully handle this scenario.

@zadjii-msft commented on GitHub (Feb 12, 2021): Does this work on Powershell 7? This sounds like an issue exacerbated by conpty's buffer being exclusively the size of the terminal window. Probably repros in regular old conhost if you set the buffer height to the viewport height. Sounds like they're not gracefully handling the case where the command takes more lines than the height of the entire buffer. That being said this would probably also repro with any other terminal emulator too. Hence why I'm thinking this might be fixed in newer versions of powershell. Since newer versions of powershell need to run on other platforms, maybe they found a way to gracefully handle this scenario.
Author
Owner

@nkasco commented on GitHub (Feb 12, 2021):

Does this work on Powershell 7?

This sounds like an issue exacerbated by conpty's buffer being exclusively the size of the terminal window. Probably repros in regular old conhost if you set the buffer height to the viewport height. Sounds like they're not gracefully handling the case where the command takes more lines than the height of the entire buffer.

That being said this would probably also repro with any other terminal emulator too. Hence why I'm thinking this might be fixed in newer versions of powershell. Since newer versions of powershell need to run on other platforms, maybe they found a way to gracefully handle this scenario.

Unfortunately it has the same behavior if I open a PS 7 tab in Windows Terminal.

I eluded to this before a bit, but if I open a regular Windows PowerShell window when I do this it gracefully scrolls and moves the cursor as it should. The same with pwsh.

There definitely have been improvements with multi-line commands in Terminal, but this piece does need a bit of work. Otherwise loving it!

@nkasco commented on GitHub (Feb 12, 2021): > Does this work on Powershell 7? > > This sounds like an issue exacerbated by conpty's buffer being exclusively the size of the terminal window. Probably repros in regular old conhost if you set the buffer height to the viewport height. Sounds like they're not gracefully handling the case where the command takes more lines than the height of the entire buffer. > > That being said this would probably also repro with any other terminal emulator too. Hence why I'm thinking this might be fixed in newer versions of powershell. Since newer versions of powershell need to run on other platforms, maybe they found a way to gracefully handle this scenario. Unfortunately it has the same behavior if I open a PS 7 tab in Windows Terminal. I eluded to this before a bit, but if I open a regular Windows PowerShell window when I do this it gracefully scrolls and moves the cursor as it should. The same with pwsh. There definitely have been improvements with multi-line commands in Terminal, but this piece does need a bit of work. Otherwise loving it!
Author
Owner

@DHowett commented on GitHub (Feb 18, 2021):

This is one of the unfortunate side effects of how Terminal has become more compatible with other terminals and less compatible with the Windows Console¹. PSReadline does not properly handle constrained height buffers, and it's something they're slowly working on fixing. It's very, very similar to the cause of https://github.com/PowerShell/PSReadLine/issues/1417.

¹ this also reproduces on the windows console if the buffer height is set to the window height.

Gotta mark this one external, sadly. Sorry!

@DHowett commented on GitHub (Feb 18, 2021): This is one of the unfortunate side effects of how Terminal has become more compatible with _other terminals_ and less compatible with the Windows Console¹. PSReadline does not properly handle constrained height buffers, and it's something they're slowly working on fixing. It's very, very similar to the cause of https://github.com/PowerShell/PSReadLine/issues/1417. ¹ this also reproduces on the windows console if the buffer height is set to the window height. Gotta mark this one external, sadly. Sorry!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#12538