Repository navigation
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 |
Jason Shirk (lzybkr)
left a comment
There was a problem hiding this comment.
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. |
|
Carl Morris (@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.