Open
Conversation
Contributor
Author
|
The failing test is with regards to the history completion behavior as expected. But since with this pr we expect a different behavior to begin with, I'm not gonna touch it for now. #[tokio::test(flavor = "multi_thread")]
async fn history_completion() -> anyhow::Result<()> {
test_key_sequence(
&mut AppBuilder::new().build()?,
Some(":asdf<ret>:theme d<C-n><tab>"),
Some(&|app| {
assert!(!app.editor.is_err());
}),
false,
)
.await?;
Ok(())
} |
Contributor
Author
|
For people interested in this feature, you might also like #15271 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously, ↑ and ↓ in prompts didn't care at all about what you have typed in — they would always cycle through the entire history.
Now the behavior is different depending on if the prompt input is empty, or filled with something.
If the prompt input is empty, ↓↑ work like normal.
If the prompt input is not empty, and it reached this state not by ↓↑, your current prompt input is taken as a substring pattern that you search for in your history.
This works for all prompts, but I'm going to use command mode as the example.
Assume you have this in your command mode history:
With your prompt input empty, ↑ will result in
echo lemon.But if instead you type in
potatoand tap ↑, you will arrive atecho potatotron. If from this state you press↑again, you reachecho potato.Pressing ↑ again doesn't change anything because
echo potatois the oldest command that substring matches the current pattern (potato)If after arriving at
echo potatotronfor the first time you edit your input in any way (even ←→ counts as an “edit” here), then that now becomes your current pattern.Type in
potato, tap ↑, end up atecho potatotron. Press ← then ↑ — nothing happens, because you are at the only result of the new pattern (echo potatotron).If instead of pressing ← you edited
echo potatotrontoecho potatotronisticand pressed ↑ — nothing would happen also, because there are no matches for that in the history.If you've used fish shell, you can refer to the ↑ behavior there: that's more or less the behavior that I'm replicating.