-
Notifications
You must be signed in to change notification settings - Fork 311
Preserve and clear the saved current line properly #1259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -633,7 +638,7 @@ private void HistorySearch(int direction) | |||
continue; | |||
} | |||
|
|||
var line = newHistoryIndex == _history.Count ? _savedCurrentLine.CommandLine : _history[newHistoryIndex].CommandLine; | |||
var line = _history[newHistoryIndex].CommandLine; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The newHistoryIndex == _history.Count
is removed because that was already checked above:
if (newHistoryIndex < 0 || newHistoryIndex >= _history.Count)
{
break;
}
I added to #1257 some minor points. While the changes to I'm wondering if |
Thanks for the additional details. You are right, it’s not just RevertLine, but a more general issue. Basically the saved line is not properly cleared after any history operation. |
@msftrncs I think the PR is ready for another review :) Happy new year! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All LGTM.
Thanks @msftrncs! |
Fix #1257
Major changes:
So when switching between different history command, such as from
F8
/Shift+F8
(HistorySearchBackward
andHistorySearchForward
) toUpArrow
/DownArrow
(recall history) or fromCtrl+r
/Ctrl+s
toUpArrow
/DownArrow
, the history command can continue to work as expected.So the saved line will not leak to another unrelated history search.