Rectable selection fixes - #452
Open
reejk wants to merge 2 commits into
Open
Conversation
…ab character at cursors positions
Before this fix, pressing Backspace with zero-length rectangular selection would cause cursor to jump up one line each time Backspace pressed. It's breaks characters deletion. Root cause - math precision issues in HeightTree.GetVisualPositionFromNode. This fix avoid that math by reading VisualTop from VisualLine.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There is two changes related to rectangular selection with zero width.
1. When pressing Tab, tabulation inserts at selection column like there is multiple cursors #397
2. When pressing Backspace, avoids cursor jumping up and losing lines from selection in result.
PR #425 is also about this problem.
How to reproduce: Replace the text in the Sample with the text below. Select all the semicolons and press Backspace twice. Selection will lose the last line.
The root cause is the precision of mathematical calculations. The
HeightTree.GetVisualPositionFromNodemethod returns a number slightly smaller than whatTextView.GetVisualLineFromVisualTopexpects for the same line.The
totalHeightsum loses precision, and thistotalHeightis also the sum of other calculations. The more work you do with the editor, the lower the precision of these calculations. At some point, the rectangular selection may lose all the initially selected lines.