Skip to content
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

Fix Rectangle Select Caret Painting #65

Merged
merged 2 commits into from
Jan 4, 2021
Merged

Fix Rectangle Select Caret Painting #65

merged 2 commits into from
Jan 4, 2021

Conversation

RobertBColton
Copy link
Contributor

@RobertBColton RobertBColton commented Jan 4, 2021

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.

Master Pull
Master Rectangle Caret Pull Rectangle Caret

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.

Visual Studio VS Code Eclipse
Visual Studio Rectangle Select VS Code Rectangle Select Eclipse Rectangle Select

@JoshDreamland JoshDreamland merged commit 11414a6 into JoshDreamland:master Jan 4, 2021
RobertBColton added a commit to IsmAvatar/LateralGM that referenced this pull request Jan 4, 2021
RobertBColton added a commit to IsmAvatar/LateralGM that referenced this pull request Jan 4, 2021
Have the caret use the same font metrics as the selection so the correct
glyph advance is used. This places the rectangle select caret in the
correct location now.
JoshDreamland/JoshEdit#65
@RobertBColton RobertBColton mentioned this pull request Jan 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants