Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions PSReadLine/History.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ public class HistoryItem
private HistoryItem _previousHistoryItem;
private Dictionary<string, int> _hashedHistory;
private int _currentHistoryIndex;
// A helper field for getting next history, specifically for AcceptAndGetNext.
// It's considered unset when its value is 0
private int _getNextHistoryIndex;
private int _searchHistoryCommandCount;
private int _recallHistoryCommandCount;
Expand Down Expand Up @@ -1140,6 +1142,9 @@ private void UpdateHistoryDuringInteractiveSearch(string toMatch, int direction,
_emphasisStart = startIndex;
_emphasisLength = toMatch.Length;
_currentHistoryIndex = searchFromPoint;
// setting next index so that when AcceptAndGetNext is triggered it can properly load next history
_getNextHistoryIndex = _currentHistoryIndex < _history.Count - 1 ? _currentHistoryIndex + 1 : 0;

var moveCursor = Options.HistorySearchCursorMovesToEnd
? HistoryMoveCursor.ToEnd
: HistoryMoveCursor.DontMove;
Expand Down