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
Correct cursor jumping from line 2 to line 1 due to line 1 being empty. #1108
Conversation
I just noticed, a similar issue when pressing home, for which this very same code occurs in |
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.
It'd be good to add a test.
If you are extra motivated, you could add a property based test using FsCheck. It seems property based testing might be a good way to catch cases like this without writing too many tests.
Test added. Any input on this?
I have this code change ready, including test for it as well. |
Closing and reopening to retrigger the CI. |
@msftrncs - Good catch finding the duplicated code - your proposed fix sounds perfect. |
eb96347
to
23f70e9
Compare
Reduce code duplication by reusing GetBeginningOfLinePos in InsertLineAbove.
Correct newline search in GetBeginningOfLinePos (HOME) and InsertLineAbove to not ignore first character in the buffer which might be a new line. Manifests as cursor jumps to line 1, because line 1 is blank, when triggered with cursor anywhere on line 2. Fixes PowerShell#1107. Fixes PowerShell#1109.
23f70e9
to
a47fddf
Compare
I have updated the commits so that |
Updated Title and PR to reflect the changes in the commits. |
Correct newline search in
GetBeginningOfLinePos()
(HOME) andInsertLineAbove()
(CTRL-ENTER) (by usingGetBeginningOfLinePos()
) to not ignore first character in the buffer which might be a new line.Manifests as cursor jumps to line 1, because line 1 is blank, when triggered with cursor anywhere on line 2.
Fixes #1107.
Fixes #1109.