@@ -307,7 +307,7 @@ private string InputLoop()
307
307
ProcessOneKey ( key , _dispatchTable , ignoreIfNoAction : false ) ;
308
308
if ( _inputAccepted )
309
309
{
310
- return MaybeAddToHistory ( _buffer . ToString ( ) ) ;
310
+ return MaybeAddToHistory ( _buffer . ToString ( ) , _edits , _undoEditIndex ) ;
311
311
}
312
312
313
313
if ( killCommandCount == _killCommandCount )
@@ -361,7 +361,7 @@ void ProcessOneKey(ConsoleKeyInfo key, Dictionary<ConsoleKeyInfo, KeyHandler> di
361
361
PostKeyHandler ( ) ;
362
362
}
363
363
364
- private string MaybeAddToHistory ( string result )
364
+ private string MaybeAddToHistory ( string result , List < EditItem > edits , int undoEditIndex )
365
365
{
366
366
bool addToHistory = ! string . IsNullOrWhiteSpace ( result ) && ( ( _addToHistoryHandler == null ) || _addToHistoryHandler ( result ) ) ;
367
367
if ( addToHistory && _historyNoDuplicates )
@@ -375,9 +375,9 @@ private string MaybeAddToHistory(string result)
375
375
{
376
376
_history . Enqueue ( new HistoryItem
377
377
{
378
- _line = _buffer . ToString ( ) ,
379
- _edits = _edits ,
380
- _undoEditIndex = _undoEditIndex
378
+ _line = result ,
379
+ _edits = edits ,
380
+ _undoEditIndex = undoEditIndex
381
381
} ) ;
382
382
_currentHistoryIndex = _history . Count ;
383
383
}
@@ -876,7 +876,8 @@ public static void EmacsBackwardWord(ConsoleKeyInfo? key = null, object arg = nu
876
876
/// </summary>
877
877
public static void AddToHistory ( string command )
878
878
{
879
- _singleton . MaybeAddToHistory ( command ) ;
879
+ command = command . Replace ( "\r \n " , "\n " ) ;
880
+ _singleton . MaybeAddToHistory ( command , new List < EditItem > ( ) , 0 ) ;
880
881
}
881
882
882
883
/// <summary>
0 commit comments