Skip to content

Commit 8c95f93

Browse files
authored
Make the continuation prompt's color sequence always explicitly specified. (#1238)
1 parent 9ad8eb6 commit 8c95f93

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

PSReadLine/Render.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ private int GenerateRender(string defaultColor)
158158
var text = ParseInput();
159159

160160
string color = defaultColor;
161-
string activeColor = "";
161+
string activeColor = string.Empty;
162162
bool afterLastToken = false;
163163
int currentLogicalLine = 0;
164164
bool inSelectedRegion = false;
@@ -302,6 +302,13 @@ void MaybeEmphasize(int i, string currColor)
302302
_consoleBufferLines.Add(new StringBuilder(COMMON_WIDEST_CONSOLE_WIDTH));
303303
}
304304

305+
// Reset the color for continuation prompt so the color sequence will always be explicitly
306+
// specified for continuation prompt in the generated render strings.
307+
// This is necessary because we will likely not rewrite all texts during rendering, and thus
308+
// we cannot assume the continuation prompt can continue to use the active color setting from
309+
// the previous rendering string.
310+
activeColor = string.Empty;
311+
305312
UpdateColorsIfNecessary(Options._continuationPromptColor);
306313
foreach (char c in Options.ContinuationPrompt)
307314
{

0 commit comments

Comments
 (0)