-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Feature Request - filledBox cursor should cover the whole unicode character #2713
Comments
Perhaps along with the UI category, there should be one for rendering? |
@mdtauk You mean like Area-Rendering? |
Is this not the same as #1203? |
I was looking at the Projects section, and only saw Design and Specification :D |
@zadjii-msft nah this is "my character is double-cell, but my cursor is single-cell." |
Something something |
You know, it's been like 5 months since the fix was proposed in #2932 and subsequently reverted. I don't totally remember what all went down with that, and reading through the notes didn't really clear it up for me. I think I'd be more comfortable with @miniksa handling this one. We did a bunch to help our use-after-free's in the Terminal codebase since then, so maybe the original fix would just work by itself now. |
I would like to do this, it's just that my stack of work is already so high and the world is sort of on fire. So we'll see. |
# Summary of the Pull Request This PR will allow the cursor to be double width when on top of a double width character. This required changing `IsCursorDoubleWidth` to check whether the glyph the cursor's on top of is double width. This code is exactly the same as the original PR that addressed this issue in #2932. That one got reverted at some point due to the crashes related to it, but due to a combination of Terminal having come further since that PR and other changes to address use-after-frees, some of the crashes may/may not be relevant now. The ones that seemed to be relevant/repro-able, I attempt to address in this PR. The `IsCursorDoubleWidth` check would fail during the `TextBuffer::Reflow` call inside of `Terminal::UserResize` occasionally, particularly when `newCursor.EndDeferDrawing()` is called. This is because when we tell the newCursor to `EndDefer`, the renderer will attempt to redraw the cursor. As part of this redraw, it'll ask if `IsCursorDoubleWidth`, and if the renderer managed to ask this before `UserResize` swapped out the old buffer with the new one from `Reflow`, the renderer will be asking the old buffer if its out-of-bounds cursor is double width. This was pretty easily repro'd using `cmatrix -u0` and resizing the window like a madman. As a solution, I've moved the Start/End DeferDrawing calls out of `Reflow` and into `UserResize`. This way, I can "clamp" the portion of the code where the newBuffer is getting created and reflowed and swapped into the Terminal buffer, and only allow the renderer to draw once the swap is done. This also means that ConHost's `ResizeWithReflow` needed to change slightly. In addition, I've added a WriteLock to `SetCursorOn`. It was mentioned as a fix for a crash in #2965 (although I can't repro), and I also figured it would be good to try to emulate where ConHost locks with regards to Cursor operations, and this seemed to be one that we were missing. ## PR Checklist * [x] Closes #2713 * [x] CLA signed * [x] Tests added/passed ## Validation Steps Performed Manual validation that the cursor is indeed chonky, added a test case to check that we are correctly saying that the cursor is double width (not too sure if I put it in the right place). Also open to other test case ideas and thoughts on what else I should be careful for since I am quite nervous about what other crashes might occur.
🎉This issue was addressed in #5319, which has now been successfully released as Handy links: |
Description of the new feature/enhancement
The filledBox cursor should not hide the covered character and it behaves differently for ASCII and wide characters:
Other terminal applications typically handle this well, take XShell for an example:
And the cursor automatically invert the covered character's color to show it properly without hiding it behind.
The text was updated successfully, but these errors were encountered: