Skip to content

Commit

Permalink
AtlasEngine: Fix cursor invalidation (#14038)
Browse files Browse the repository at this point in the history
There's a different behavior regarding cursors between conhost and Windows
Terminal. In case of the latter we don't necessarily call `PaintCursor`
during cursor movement, because the cursor blinker never stops "blinking".

Closes #14028

## Validation Steps Performed
* Enter text until after the line wraps
* Hold backspace until the line unwraps
* No leftover cursor on the second line ✅
  • Loading branch information
lhecker authored Sep 20, 2022
1 parent f79276b commit 08096b2
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/renderer/atlas/AtlasEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,13 @@ try
_r.dirtyRect = _api.dirtyRect;
_r.scrollOffset = _api.scrollOffset;

// Clear the previous cursor. PaintCursor() is only called if the cursor is on.
if (const auto r = _api.invalidatedCursorArea; r.non_empty())
{
_setCellFlags(r, CellFlags::Cursor, CellFlags::None);
_r.dirtyRect |= til::rect{ r.left, r.top, r.right, r.bottom };
}

// This is an important block of code for our TileHashMap.
// We only process glyphs within the dirtyRect, but glyphs outside of the
// dirtyRect are still in use and shouldn't be discarded. This is critical
Expand Down Expand Up @@ -437,13 +444,6 @@ try
}
}

// Clear the previous cursor
if (const auto r = _api.invalidatedCursorArea; r.non_empty())
{
_setCellFlags(r, CellFlags::Cursor, CellFlags::None);
_r.dirtyRect |= til::rect{ r.left, r.top, r.right, r.bottom };
}

if (options.isOn)
{
const auto point = options.coordCursor;
Expand Down

0 comments on commit 08096b2

Please sign in to comment.