diff --git a/README.md b/README.md index 3e31c24..9cca69e 100644 --- a/README.md +++ b/README.md @@ -403,6 +403,9 @@ parameter must be a string. - **shiftLine(i)** - shift a line off the top of the content. - **pushLine(lines)** - push a line onto the bottom of the content. - **popLine(i)** - pop a line off the bottom of the content. +- **getLines()** - an array containing the content lines. +- **getScreenLines()** - an array containing the lines as they are displayed on + the screen. #### Box (from Element) diff --git a/lib/widget.js b/lib/widget.js index 4279188..76b254b 100644 --- a/lib/widget.js +++ b/lib/widget.js @@ -3518,6 +3518,14 @@ Element.prototype.popLine = function(n) { return this.deleteLine(this._clines.fake.length - 1, n); }; +Element.prototype.getLines = function() { + return this._clines.fake.slice(); +}; + +Element.prototype.getScreenLines = function() { + return this._clines.slice(); +}; + /** * Box */ @@ -3889,7 +3897,7 @@ ScrollableBox.prototype.resetScroll = function() { return this.emit('scroll'); }; -ScrollableBox.prototype.getScrollHeight = function(s) { +ScrollableBox.prototype.getScrollHeight = function() { return Math.max(this._clines.length, this._scrollBottom()); }; @@ -4278,6 +4286,11 @@ List.prototype.pick = function(callback) { var focused = this.screen.focused; if (focused && focused._done) focused._done('stop'); this.screen.saveFocus(); + + //var parent = this.parent; + //this.detach(); + //parent.append(this); + this.focus(); this.show(); this.screen.render(); @@ -5458,6 +5471,10 @@ Prompt.prototype.type = function(text, value, callback) { value = ''; } + //var parent = this.parent; + //this.detach(); + //parent.append(this); + this.show(); this.setContent(' ' + text); @@ -5540,6 +5557,10 @@ Question.prototype.ask = function(text, callback) { var self = this; var press, okay, cancel; + //var parent = this.parent; + //this.detach(); + //parent.append(this); + this.show(); this.setContent(' ' + text); @@ -5609,9 +5630,9 @@ Message.prototype.display = function(text, time, callback) { if (time == null) time = 3; //time = time || 3; - var parent = this.parent; - this.detach(); - parent.append(this); + //var parent = this.parent; + //this.detach(); + //parent.append(this); if (this.scrollable) { this.screen.saveFocus(); @@ -5712,6 +5733,10 @@ Loading.prototype.type = 'loading'; Loading.prototype.load = function(text) { var self = this; + //var parent = this.parent; + //this.detach(); + //parent.append(this); + this.show(); this.setContent(text);