Skip to content

Commit b41113e

Browse files
committed
Fix undo bug
When recalling a line from history multiple times and making edits to that line, the undo stack was incorrect. The fix was to make a copy of the undo stack when recalling from history. Example repro: ls Enter UpArrow Escape dir Enter UpArrow UpArrow Escape
1 parent e9e2d0e commit b41113e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

PSReadLine/History.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ private void UpdateFromHistory(bool moveCursor)
262262
else
263263
{
264264
line = _history[_currentHistoryIndex]._line;
265-
_edits = _history[_currentHistoryIndex]._edits;
265+
_edits = new List<EditItem>(_history[_currentHistoryIndex]._edits);
266266
_undoEditIndex = _history[_currentHistoryIndex]._undoEditIndex;
267267
}
268268
_buffer.Clear();

0 commit comments

Comments
 (0)