From 7edfa93cd2f42ab541529d60b3485490db9e9213 Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Wed, 20 Oct 2021 17:48:13 -0700 Subject: [PATCH] Reset all attributes before changing color in rendering to avoid color leaking (#2925) --- PSReadLine/Render.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/PSReadLine/Render.cs b/PSReadLine/Render.cs index f978770..354cd81 100644 --- a/PSReadLine/Render.cs +++ b/PSReadLine/Render.cs @@ -177,7 +177,12 @@ namespace Microsoft.PowerShell { if (!object.ReferenceEquals(newColor, activeColor)) { - if (!inSelectedRegion) _consoleBufferLines[currentLogicalLine].Append(newColor); + if (!inSelectedRegion) + { + _consoleBufferLines[currentLogicalLine] + .Append(VTColorUtils.AnsiReset) + .Append(newColor); + } activeColor = newColor; } }