Skip to content
Snippets Groups Projects
Commit cc200643 authored by George Nachman's avatar George Nachman
Browse files

Fix up using the regular ac window.

parent 1343029a
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -622,7 +622,7 @@ const int kMaxResultContextWords = 4;
NSTimeInterval timeSinceLastUse = now - entry.lastUsed;
score /= MAX(1, sqrt(timeSinceLastUse / (24 * 60 * 60.0)));
score = MIN(5, score); // Limit score of commands so really relevant context has a chance.
score = MIN(10, score); // Limit score of commands so really relevant context has a chance.
NSLog(@"Add command %@ with score %f", entry.command, score);
PopupEntry* e = [PopupEntry entryWithString:[entry.command substringFromIndex:context.length]
score:score];
Loading
Loading
Loading
Loading
@@ -68,6 +68,19 @@
return nil;
}
 
- (void)removeLowestScoringEntry
{
PopupEntry *entryWithMinScore = nil;
for (PopupEntry *entry in values_) {
if (!entryWithMinScore || entry.score < entryWithMinScore.score) {
entryWithMinScore = entry;
}
}
if (entryWithMinScore) {
[values_ removeObject:entryWithMinScore];
}
}
- (void)addHit:(PopupEntry*)object
{
PopupEntry* entry = [self entryEqualTo:object];
Loading
Loading
@@ -78,6 +91,8 @@
[self addObject:object];
PopLog(@"Add entry for %@ with score %lf", [object mainValue], [object score]);
} else {
[self removeLowestScoringEntry];
[self addObject:object];
PopLog(@"Not adding entry because max of %u hit", maxEntries_);
}
}
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment