mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-30 03:01:15 -03:00
reader handle_completions(): remove dead code for skipping to add prefix
The tuple (will_replace_token, all_matches_exact_or_prefix) can never be (false, false). Proof by contraction: 1. Goal: show unsatisfiability of: !will_replace_token && !all_matches_exact_or_prefix 2. Substitute defintions: !all(replaces) && !all(is_exact_or_prefix) 3. wlog, !replaces(c1) && !is_exact_or_prefix(c2) 4. since c1 and c2 have same rank we know that !is_exact_or_prefix(c1) 5. !is_exact_or_prefix() implies requires_full_replacement() 6. all callers that create a Completion from StringFuzzyMatch::try_create(), set CompleteFlags::REPLACE_TOKEN if requires_full_replacement(), so requires_full_replacement() implies replaces() 7. From 4-6 follows: !is_exact_or_prefix(c1) implies replaces(c1), which is a contradiction
This commit is contained in:
@@ -6808,7 +6808,8 @@ fn handle_completions(&mut self, token_range: Range<usize>, comp: Vec<Completion
|
||||
|
||||
// Print the completion list.
|
||||
let mut prefix = WString::new();
|
||||
if will_replace_token || !all_matches_exact_or_prefix {
|
||||
assert!(will_replace_token || all_matches_exact_or_prefix);
|
||||
if will_replace_token {
|
||||
if use_prefix {
|
||||
prefix.push_utfstr(&common_prefix);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user