Skip to content

Commit a181aac

Browse files
committed
Clear emphasis if any before accepting a line.
1 parent 6b4cd5b commit a181aac

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

PSReadLine/BasicEditing.cs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,16 +184,25 @@ private bool AcceptLineImpl()
184184
return false;
185185
}
186186

187+
// If text was pasted, for performance reasons we skip rendering for some time,
188+
// but if input is accepted, we won't have another chance to render.
189+
//
190+
// Also - if there was an emphasis, we want to clear that before accepting
191+
// and that requires rendering.
192+
bool renderNeeded = _emphasisStart >= 0 || _queuedKeys.Count > 0;
193+
187194
_renderForDemoNeeded = false;
195+
_emphasisStart = -1;
196+
_emphasisLength = 0;
188197

189198
// Make sure cursor is at the end before writing the line
190199
_current = _buffer.Length;
191-
if (_queuedKeys.Count > 0)
200+
201+
if (renderNeeded)
192202
{
193-
// If text was pasted, for performance reasons we skip rendering for some time,
194-
// but if input is accepted, we won't have another chance to render.
195203
ReallyRender();
196204
}
205+
197206
var coordinates = ConvertOffsetToCoordinates(_current);
198207
var y = coordinates.Y + 1;
199208
PlaceCursor(0, ref y);

0 commit comments

Comments
 (0)