Repository: microsoft/terminal (language: cpp)

Issue:
Atlas Engine: The cursor leaves artifacts when you delete a long line
### Windows Terminal version

1.16.2524.0

### Windows build number

10.0.22000.0

### Other Software

pwsh 7.2.6, PSReadLine 2.2.6
cmd.exe

### Steps to reproduce

Type long string and delete they by holding Backspace key pressed. 
This behavior is only then `"useAtlasEngine": true` 

![01](https://user-images.githubusercontent.com/78153320/190914018-ea9ad1b5-c8f3-4d22-a706-ef214f987a96.png)
![02](https://user-images.githubusercontent.com/78153320/190914030-cecc28cf-f948-45ee-a6d9-a49e544c85a7.png)
![03](https://user-images.githubusercontent.com/78153320/190914037-e2c06f41-90a2-445a-9bf6-0caca17190ac.png)




### Expected Behavior

No artifacts

### Actual Behavior

Deleting long line leaves artifacts.


Discussion / hints:
Actually I'm not entirely sure if this is an AtlasEngine issue... Cursor wrap around is just weird right now and my cursor vanishes / stops blinking when I wrap to the previous line with backspace.
...And this issue is entirely exclusive to Windows Terminal. It doesn't happen with OpenConsole.
Figured it out: 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".

Fix patch:
diff --git a/src/renderer/atlas/AtlasEngine.cpp b/src/renderer/atlas/AtlasEngine.cpp
index ae4b1f8e2ed..d6d3dd45645 100644
--- a/src/renderer/atlas/AtlasEngine.cpp
+++ b/src/renderer/atlas/AtlasEngine.cpp
@@ -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
@@ -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;


Test patch: