fuzzyFind callback convention.

This commit is contained in:
Christopher Jeffrey 2015-04-18 22:25:13 -07:00
parent 2c00450029
commit 564592891c
2 changed files with 7 additions and 3 deletions

View File

@ -70,7 +70,7 @@ var list = blessed.list({
search: function(callback) { search: function(callback) {
prompt.input('Search:', '', function(err, value) { prompt.input('Search:', '', function(err, value) {
if (err) return; if (err) return;
return callback(value); return callback(null, value);
}); });
} }
}); });

View File

@ -5133,8 +5133,12 @@ function List(options) {
if (typeof self.options.search !== 'function') { if (typeof self.options.search !== 'function') {
return; return;
} }
return self.options.search(function(value) { return self.options.search(function(err, value) {
if (!value) return self.screen.render(); if (typeof err === 'string' || (err && err.test)) {
value = err;
err = null;
}
if (err || !value) return self.screen.render();
self.select(self.fuzzyFind(value, key.ch === '?')); self.select(self.fuzzyFind(value, key.ch === '?'));
self.screen.render(); self.screen.render();
}); });