diff --git a/example/ansi-viewer/index.js b/example/ansi-viewer/index.js index 86e1099..5d6ad06 100644 --- a/example/ansi-viewer/index.js +++ b/example/ansi-viewer/index.js @@ -70,7 +70,7 @@ var list = blessed.list({ search: function(callback) { prompt.input('Search:', '', function(err, value) { if (err) return; - return callback(value); + return callback(null, value); }); } }); diff --git a/lib/widget.js b/lib/widget.js index 398de54..1f102f9 100644 --- a/lib/widget.js +++ b/lib/widget.js @@ -5133,8 +5133,12 @@ function List(options) { if (typeof self.options.search !== 'function') { return; } - return self.options.search(function(value) { - if (!value) return self.screen.render(); + return self.options.search(function(err, value) { + 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.screen.render(); });