Fix Rectangle Select Caret Painting #65
Merged
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.
This has been bugging me for a while and is not a regression, it's been this way since LateralGM 1.8.2 and I want to fix it. When you do a rectangle select, the caret paints way off from the rectangle at some horizontal column that seems to be twice the width of the selection area. The problem is that when the selection switches to rectangle mode, the character index is converted to a column that goes between tabs. I don't actually understand that much, because none of the other editors I tested, including Scintilla, treat tabs that way, but maybe Josh has seen an editor like that.
Regardless, the solution to fix the caret painting was to have it using the same metrics as the selection does to paint. This is me selecting from top-right to bottom-left by the way, to test it working in reverse. It works in the other directions now too. This also fixes the size of the OVERWRITE mode caret, which was previously too wide.
Another thing to mention here is that we are not flashing the caret when in rectangle mode. Every other editor, except for Eclipse, that I tested blinks the cursor in rectangle mode, Scintilla too. We might want to change that later on. There's also some other anomalies in that Visual Studio Code will actually give each line a different caret bounded to that line's width. Regular Visual Studio does the same thing but doesn't bound the caret as it seems to use virtual whitespace like JoshEdit does. However, it does paint the current row's caret a different color than the other rows in the selection.