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

Don't allow a linefeed to scroll when outside DECSTBM margins #3704

Merged
2 commits merged into from
Dec 11, 2019

Conversation

j4james
Copy link
Collaborator

@j4james j4james commented Nov 26, 2019

Summary of the Pull Request

When the DECSTBM margins are set, scrolling should only allowed within
those margins. So if the cursor is below the bottom margin, it should
just be clamped when it tries to move down from the bottom line of the
viewport, instead of scrolling the screen up. This PR implements that
restriction, i.e. it prevents scrolling taking place outside the
DECSTBM margins, which was previously allowed.

PR Checklist

Detailed Description of the Pull Request / Additional comments

This simply adds a condition in the AdjustCursorPosition function to
check if the cursor is moving below the bottom of the viewport when the
margins are set. If so, it clamps the y coordinate to the bottom line of
the viewport.

The only time it's acceptable for scrolling to happen when margins are
set, is if the scrolling is taking place within those margins. But those
cases would already have been handled earlier in the function (in the
fScrollDown or scrollDownAtTop conditions), and thus the y
coordinate would have already been prevented from moving out of the
viewport.

Validation Steps Performed

I've added some screen buffer tests to confirm this new behaviour, and
I've also checked the test case from the initial bug report (#2657) and
made sure it now matches the results in XTerm.

@DHowett-MSFT
Copy link
Contributor

Thank you!

@DHowett-MSFT DHowett-MSFT added the AutoMerge Marked for automatic merge by the bot when requirements are met label Dec 11, 2019
@ghost
Copy link

ghost commented Dec 11, 2019

Hello @DHowett-MSFT!

Because this pull request has the AutoMerge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@ghost ghost merged commit 6f21f30 into microsoft:master Dec 11, 2019
@j4james j4james deleted the fix-lf-outside-margins branch December 15, 2019 01:52
@ghost
Copy link

ghost commented Jan 14, 2020

🎉Windows Terminal Preview v0.8.10091.0 has been released which incorporates this pull request.:tada:

Handy links:

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AutoMerge Marked for automatic merge by the bot when requirements are met
Projects
None yet
Development

Successfully merging this pull request may close these issues.

LF shouldn't scroll the viewport when below the bottom margin
3 participants