From 15730576e5ef75cb1c01a867d7bd414572783604 Mon Sep 17 00:00:00 2001 From: Phil Crosby Date: Fri, 4 May 2012 23:33:00 -0700 Subject: shorten FuzzyHistoryCompletionSource --- lib/completion.js | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'lib') diff --git a/lib/completion.js b/lib/completion.js index 13be5551..103131dd 100644 --- a/lib/completion.js +++ b/lib/completion.js @@ -140,22 +140,22 @@ var completion = (function() { }); /** A fuzzy history completer */ - var FuzzyHistoryCompletionSource = function(maxResults) { - AsyncCompletionSource.call(this); - this.maxResults = maxResults; - } - utils.extend(AsyncCompletionSource, FuzzyHistoryCompletionSource); + var FuzzyHistoryCompletionSource = AsyncCompletionSource.extend({ + init: function(maxResults) { + this._super(); + this.maxResults = maxResults; + }, - FuzzyHistoryCompletionSource.prototype.refresh = function() { - var self = this; - self.reset(); + refresh: function() { + this.reset(); - historyCache.use(function(history) { - self.resultsReady(history.slice(-self.maxResults).map(function(item) { - return self.createInternalMatch('history', item); - })) - }); - } + historyCache.use(function(history) { + this.resultsReady(history.slice(-this.maxResults).map(function(item) { + return this.createInternalMatch("history", item); + }.proxy(this))); + }.proxy(this)); + } + }); /** A fuzzy tab completer */ var FuzzyTabCompletionSource = function() { -- cgit v1.2.3