When the user input contains capital letters, use its case rather than the autosuggestion's case

Fixes https://github.com/fish-shell/fish-shell/issues/335
This commit is contained in:
ridiculousfish
2013-01-05 15:21:42 -08:00
parent 8d4a701f86
commit 85fdf587c0
4 changed files with 67 additions and 12 deletions

View File

@@ -1022,6 +1022,18 @@ static void test_autosuggest_suggest_special()
system("rm -Rf ~/test_autosuggest_suggest_special/");
}
static void test_autosuggestion_combining()
{
say(L"Testing autosuggestion combining");
assert(combine_command_and_autosuggestion(L"alpha", L"alphabeta") == L"alphabeta");
// when the last token contains no capital letters, we use the case of the autosuggestion
assert(combine_command_and_autosuggestion(L"alpha", L"ALPHABETA") == L"ALPHABETA");
// when the last token contains capital letters, we use its case
assert(combine_command_and_autosuggestion(L"alPha", L"alphabeTa") == L"alPhabeTa");
}
/**
Test speed of completion calculations
@@ -1625,6 +1637,7 @@ int main(int argc, char **argv)
test_word_motion();
test_is_potential_path();
test_colors();
test_autosuggestion_combining();
test_autosuggest_suggest_special();
history_tests_t::test_history();
history_tests_t::test_history_merge();