diff --git a/lib/widget.js b/lib/widget.js index 75eafdb..5a267b3 100644 --- a/lib/widget.js +++ b/lib/widget.js @@ -3090,18 +3090,9 @@ FileManager.prototype.pick = function(cwd, callback) { var self = this , focused = this.screen.focused === this - , hidden = this.hidden; - - if (hidden) { - this.show(); - } - - if (!focused) { - this.screen.saveFocus(); - this.focus(); - } - - var onfile, oncancel; + , hidden = this.hidden + , onfile + , oncancel; function resume() { self.removeListener('file', onfile); @@ -3127,6 +3118,16 @@ FileManager.prototype.pick = function(cwd, callback) { this.refresh(cwd, function(err) { if (err) return callback(err); + + if (hidden) { + self.show(); + } + + if (!focused) { + self.screen.saveFocus(); + self.focus(); + } + self.screen.render(); }); };