diff --git a/PSReadLine/PlatformWindows.cs b/PSReadLine/PlatformWindows.cs index 7abc4bba..4fce03f6 100644 --- a/PSReadLine/PlatformWindows.cs +++ b/PSReadLine/PlatformWindows.cs @@ -416,6 +416,7 @@ internal class LegacyWin32Console : VirtualTerminal {45, () => Console.BackgroundColor = ConsoleColor.DarkMagenta}, {43, () => Console.BackgroundColor = ConsoleColor.DarkYellow}, {47, () => Console.BackgroundColor = ConsoleColor.Gray}, + {49, () => Console.BackgroundColor = InitialBG}, {100, () => Console.BackgroundColor = ConsoleColor.DarkGray}, {104, () => Console.BackgroundColor = ConsoleColor.Blue}, {102, () => Console.BackgroundColor = ConsoleColor.Green}, @@ -432,6 +433,7 @@ internal class LegacyWin32Console : VirtualTerminal {35, () => Console.ForegroundColor = ConsoleColor.DarkMagenta}, {33, () => Console.ForegroundColor = ConsoleColor.DarkYellow}, {37, () => Console.ForegroundColor = ConsoleColor.Gray}, + {39, () => Console.ForegroundColor = InitialFG}, {90, () => Console.ForegroundColor = ConsoleColor.DarkGray}, {94, () => Console.ForegroundColor = ConsoleColor.Blue}, {92, () => Console.ForegroundColor = ConsoleColor.Green}, diff --git a/PSReadLine/Render.cs b/PSReadLine/Render.cs index 83ef4586..970e3f77 100644 --- a/PSReadLine/Render.cs +++ b/PSReadLine/Render.cs @@ -122,8 +122,7 @@ private void Render() private void ForceRender() { - var defaultColor = VTColorUtils.MapColorToEscapeSequence(_console.ForegroundColor, isBackground: false) + - VTColorUtils.MapColorToEscapeSequence(_console.BackgroundColor, isBackground: true); + var defaultColor = "\x1b[39;49m"; // Geneate a sequence of logical lines with escape sequences for coloring. int logicalLineCount = GenerateRender(defaultColor); diff --git a/test/MockConsole.cs b/test/MockConsole.cs index 9d321c0d..a451d1a0 100644 --- a/test/MockConsole.cs +++ b/test/MockConsole.cs @@ -313,6 +313,7 @@ private static void ToggleNegative(TestConsole c, bool b) {"45", c => c.BackgroundColor = ConsoleColor.DarkMagenta}, {"43", c => c.BackgroundColor = ConsoleColor.DarkYellow}, {"47", c => c.BackgroundColor = ConsoleColor.Gray}, + {"49", c => c.BackgroundColor = DefaultBackground}, {"100", c => c.BackgroundColor = ConsoleColor.DarkGray}, {"104", c => c.BackgroundColor = ConsoleColor.Blue}, {"102", c => c.BackgroundColor = ConsoleColor.Green}, @@ -329,6 +330,7 @@ private static void ToggleNegative(TestConsole c, bool b) {"35", c => c.ForegroundColor = ConsoleColor.DarkMagenta}, {"33", c => c.ForegroundColor = ConsoleColor.DarkYellow}, {"37", c => c.ForegroundColor = ConsoleColor.Gray}, + {"39", c => c.ForegroundColor = DefaultForeground}, {"90", c => c.ForegroundColor = ConsoleColor.DarkGray}, {"94", c => c.ForegroundColor = ConsoleColor.Blue}, {"92", c => c.ForegroundColor = ConsoleColor.Green},