migueldeicaza / SwiftTerm

Xterm/VT100 Terminal emulator in Swift
MIT License
993 stars 146 forks source link

Fix Caret Drawing Artifacts #348

Closed thecoolwinter closed 3 months ago

thecoolwinter commented 3 months ago

Updates the caret drawing function to clip to it's bounds. Fixes a small visual bug where the unfocused box stuck around in the layer because it was never cleared due to it being outside the view's bounds. Fixes by first clearing the entire layer and then drawing.

Updates the macOS Caret background color when the color is set using the public variable. Fixes an issue where the caret color was not being used on macOS if it was changed after initialization.

Screenshots Caret drawing is mostly the same, just that it's only drawing inside the bounds of the cell the cursor is in.

Caret drawing without patch, note leftover stroke artifacts from the unfocused box when focused: Screenshot 2024-08-08 at 10 27 27 AM Screenshot 2024-08-08 at 10 26 59 AM Screenshot 2024-08-08 at 10 27 03 AM Screenshot 2024-08-08 at 10 27 30 AM

Caret drawing with patch: macOS from CodeEdit Focused, block Screenshot 2024-08-08 at 9 59 29 AM Screenshot 2024-08-08 at 9 59 25 AM Focused, underline Screenshot 2024-08-08 at 9 58 43 AM Screenshot 2024-08-08 at 9 58 40 AM Focused, bar Screenshot 2024-08-08 at 9 58 32 AM Unfocused Screenshot 2024-08-08 at 9 59 33 AM Screenshot 2024-08-08 at 9 59 38 AM iOS from example SSH app IMG_8129 IMG_8133 IMG_8132 IMG_8131

migueldeicaza commented 3 months ago

Thank you for your contribution!