Skip to content

Commit

Permalink
Apply completion aggressiveness flag everywhere.
Browse files Browse the repository at this point in the history
We missed a spot, so depending on the path you took the
completion controller could still aggressively choose to
close the window based on only having 1 completion, even
if completion was initiated in a non-aggressive way.
  • Loading branch information
Shadowfiend committed Jul 27, 2013
1 parent 841d234 commit 835a00e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
Binary file added .DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions app/ViCompletionController.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ appendedStringWithoutCompleting:(NSString *)string;
NSPoint _screenOrigin;
BOOL _upwards;
BOOL _fuzzySearch;
BOOL _aggressive;
}

@property (nonatomic, readwrite, assign) id<ViCompletionDelegate> delegate;
Expand Down
6 changes: 3 additions & 3 deletions app/ViCompletionController.m
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ - (void)completionResponse:(NSArray *)array error:(NSError *)error
[self cancel:nil];
return;
}
} else if ([_filteredCompletions count] == 1) {
} else if ([_filteredCompletions count] == 1 && _aggressive) {
if ([window isVisible]) {
[self acceptByKey:0];
} else {
Expand Down Expand Up @@ -220,7 +220,7 @@ - (ViCompletion *)chooseFrom:(id<ViCompletionProvider>)aProvider
_options = [optionString retain];
_fuzzySearch = ([_options rangeOfString:@"f"].location != NSNotFound);
// Aggressive means we auto-select a unique suggestion.
BOOL aggressive = ([_options rangeOfString:@"?"].location == NSNotFound);
_aggressive = [_options rangeOfString:@"?"].location == NSNotFound;
_screenOrigin = origin;
_upwards = (direction == 1);

Expand All @@ -241,7 +241,7 @@ - (ViCompletion *)chooseFrom:(id<ViCompletionProvider>)aProvider
}
[self completionResponse:result error:nil];

if (_onlyCompletion && aggressive) {
if (_onlyCompletion && _aggressive) {
DEBUG(@"returning %@ as only completion", _onlyCompletion);
[self reset];
ViCompletion *ret = [_onlyCompletion autorelease];
Expand Down
12 changes: 12 additions & 0 deletions test
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
2013-07-27 11:36:42.802 Vico[53194:303] -[ViBundleItem initFromDictionary:inBundle:]:133: refusing to map <esc> to bundle command Unnumbered Equation
2013-07-27 11:36:42.807 Vico[53194:303] -[ViBundleStore loadBundleFromDirectory:loadPluginCode:]:80: replacing bundle <ViBundle 0x10140fa20: Ack (10FB5B6B-E43F-4CB0-AEF3-933E74BF4A73)> with <ViBundle 0x10836f080: Ack (10FB5B6B-E43F-4CB0-AEF3-933E74BF4A73)>
2013-07-27 11:36:42.812 Vico[53194:303] -[ViBundleSnippet initFromDictionary:inBundle:]:38: missing snippet content in bundle item { override in empty embedded
2013-07-27 11:36:42.826 Vico[53194:303] -[ViAppController eval:withParser:bindings:error:]:611: NuUndefinedSuperclass: undefined superclass PHBTask
2013-07-27 11:36:42.827 Vico[53194:303] -[ViBundle loadPluginCode]:527: /Users/Shadowfiend/Library/Application Support/Vico/Bundles/Shadowfiend-simple-build-tool.tmbundle/main.nu: Got exception NuUndefinedSuperclass: undefined superclass PHBTask
2013-07-27 11:36:43.592 Vico[53194:303] -[ViAppController applicationWillFinishLaunching:]:384: launched after 1.000549s
2013-07-27 11:36:43.837 Vico[53194:303] -[ViMark setDocument:]:256: got non-document <ViProject: 0x1038bb460> for mark <ViMark 0x1082e5860 ((null)): <ViProject: 0x1038bb460>, 18446744073709551615:18446744073709551615 {9223372036854775807, 0}>
2013-07-27 11:36:43.842 Vico[53194:303] Setting things to (
"<ViStatusNotificationLabel: 0x10113c800>",
"<ViStatusNotificationLabel: 0x10ac06370>"
)
make: *** [run] Interrupt: 2

0 comments on commit 835a00e

Please sign in to comment.