-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
Move cursor to left margin for IL and DL controls #2731
Conversation
… DL escape sequences.
… to the left margin.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like the way I'd do it. Great work as always :)
Should this be filed as a backlog future work item? |
This certainly needs a follow up work item. I'm reviewing some of the code in each of these to try to come up with reasoning why you should use one over the other... and I'm realizing that this is probably the source of our "the cursor is blinking weirdly or is on when it shouldn't be while text is outputting" problems. As far as I can tell, you've chosen the correct one with I am certain the inconsistency in application of which cursor-setting-function is being used is responsible for graphical glitches. |
I created #2739 for this one. I left it up to @j4james and @zadjii-msft to determine if they want to track a future work item for |
* Move cursor position to the left margin after execution of the IL and DL escape sequences. * Update IL and DL screen buffer tests to account for the cursor moving to the left margin. (cherry picked from commit 1fccbc5)
🎉 Handy links: |
This went out for conhost in insider build 19002! Thanks 😄 |
Summary of the Pull Request
According to the DEC STD 070 manual, the cursor position should be moved to the left margin after the execution of the
IL
andDL
escape sequences. This PR updates the code to implement that behaviour.PR Checklist
Detailed Description of the Pull Request / Additional comments
I've modified the
DoSrvPrivateModifyLinesImpl
function (which is where theIL
andDL
controls are ultimately handled), to update the cursor position - setting the column to 0 - after the screen has been scrolled. Note that this has to happen inside theIsCursorInMargins
check, since the cursor is not supposed to be moved if it was outside the margin boundaries.Also note that this should really be set to the left margin specified by
DECSLRM
, but we don't yet support that control, so for now it's hardcoded to 0.When it came to actually setting the cursor position, I found there were a number of options to choose from, with quite different behaviours. Some operations use a variation of
SetConsoleCursorPosition
, some useAdjustCursorPosition
, and some call theSCREEN_INFORMATION::SetCursorPosition
method directly, or even justCursor::SetPosition
. It wasn't always clear to why a particular method was chosen.I ultimately decided on
SCREEN_INFORMATION::SetCursorPosition
with theTurnOn
parameter set to false, since that seemed the simplest option that also matched the behaviour of a carriage return. I'm not certain that's the best choice, though, so I'm open to other suggestions.Validation Steps Performed
There were a number of existing
IL
andDL
tests that assumed the cursor position was not meant to move, and validated that behaviour. I've updated all of those tests to confirm that cursor position is now moved to column 0 when those escape sequences are executed.