Fixes #4236. CursesDriver erase the previous text under the cursor when moving if Force16Colors is true (#4237)

* Fixes #4236. CursesDriver erase the previous text under the cursor when moving if Force16Colors is true

* Still trying to fix fluent unit tests

* Fix nullable issue

---------

Co-authored-by: Tig <tig@users.noreply.github.com>
This commit is contained in:
BDisp
2025-09-10 17:46:59 +01:00
committed by GitHub
parent da9286d3f4
commit 02d24bba69
3 changed files with 13 additions and 10 deletions

View File

@@ -536,6 +536,8 @@ internal class CursesDriver : ConsoleDriver
return true;
}
private EscSeqUtils.DECSCUSR_Style? _currentDecscusrStyle;
/// <inheritdoc/>
public override bool SetCursorVisibility (CursorVisibility visibility)
{
@@ -547,17 +549,19 @@ internal class CursesDriver : ConsoleDriver
if (!RunningUnitTests)
{
Curses.curs_set (((int)visibility >> 16) & 0x000000FF);
Curses.leaveok (_window!.Handle, !Force16Colors);
}
if (visibility != CursorVisibility.Invisible)
{
_mainLoopDriver?.WriteRaw (
EscSeqUtils.CSI_SetCursorStyle (
(EscSeqUtils.DECSCUSR_Style)
(((int)visibility >> 24)
& 0xFF)
)
);
if (_currentDecscusrStyle is null || _currentDecscusrStyle != (EscSeqUtils.DECSCUSR_Style)(((int)visibility >> 24) & 0xFF))
{
_currentDecscusrStyle = (EscSeqUtils.DECSCUSR_Style)(((int)visibility >> 24) & 0xFF);
_mainLoopDriver?.WriteRaw (
EscSeqUtils.CSI_SetCursorStyle ((EscSeqUtils.DECSCUSR_Style)_currentDecscusrStyle)
);
}
}
_currentCursorVisibility = visibility;

View File

@@ -249,8 +249,7 @@ internal class UnixMainLoop : IMainLoopDriver
private class Watch
{
// BUGBUG: Fix this nullable issue.
public Func<MainLoop, bool> Callback;
public Func<MainLoop, bool>? Callback;
public Condition Condition;
public int File;
}

View File

@@ -10,7 +10,7 @@ internal static class ViewCollectionHelpers
// The list parameter might be the live `_subviews`, so freeze it under a lock
lock (list)
{
return [.. list]; // C# 12 slice copy (= new List<View>(list).ToArray())
return list.ToArray (); // Its slightly less “fancy C# 12”, but much safer in multithreaded code
}
}