mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 07:47:54 +01:00
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:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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 (); // It’s slightly less “fancy C# 12”, but much safer in multithreaded code
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user