mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
On Windows, reset cursor visibility back to previous state when rendering progress (#16782)
* On Windows, reset cursor visibility back to previous state when rendering progress * Update src/Microsoft.PowerShell.ConsoleHost/host/msh/ProgressPane.cs Co-authored-by: Ilya <darpa@yandex.ru> Co-authored-by: Ilya <darpa@yandex.ru>
This commit is contained in:
@@ -301,7 +301,17 @@ namespace Microsoft.PowerShell
|
||||
{
|
||||
if (_content is not null)
|
||||
{
|
||||
// On Windows, we can check if the cursor is currently visible and not change it to visible
|
||||
// if it is intentionally hidden. On Unix, it is not currently supported to read the cursor visibility.
|
||||
#if UNIX
|
||||
Console.CursorVisible = false;
|
||||
#else
|
||||
bool currentCursorVisible = Console.CursorVisible;
|
||||
if (currentCursorVisible)
|
||||
{
|
||||
Console.CursorVisible = false;
|
||||
}
|
||||
#endif
|
||||
|
||||
var currentPosition = _rawui.CursorPosition;
|
||||
_rawui.CursorPosition = _location;
|
||||
@@ -319,7 +329,11 @@ namespace Microsoft.PowerShell
|
||||
}
|
||||
|
||||
_rawui.CursorPosition = currentPosition;
|
||||
#if UNIX
|
||||
Console.CursorVisible = true;
|
||||
#else
|
||||
Console.CursorVisible = currentCursorVisible;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user