Skip to content

Commit

Permalink
Fix console issue when inserting characters (#470)
Browse files Browse the repository at this point in the history
  • Loading branch information
tlmii authored Jan 7, 2021
1 parent 276b66b commit c28ef49
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Microsoft.Repl/Input/InputManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -355,9 +355,11 @@ public async Task StartAsync(IShellState state, CancellationToken cancellationTo
{
state.ConsoleManager.IsCaretVisible = false;
_inputBuffer.Insert(CaretPosition, keyPress.KeyChar);
int currentCaretPosition = CaretPosition;
string s = new string(_inputBuffer.ToArray(), CaretPosition, _inputBuffer.Count - CaretPosition);
state.ConsoleManager.Write(s);
// Since we're "inserting", move the console cursor back by one fewer
// than the length of the string just written to the console
state.ConsoleManager.MoveCaret(-1 * (s.Length - 1));
state.ConsoleManager.IsCaretVisible = true;
MoveCaret(1);
}
Expand Down

0 comments on commit c28ef49

Please sign in to comment.