Skip to content

Commit

Permalink
fix: update incorrect isScrollable constraints
Browse files Browse the repository at this point in the history
PR-URL: stdlib-js#2293
Ref: stdlib-js#2149

Signed-off-by: Snehil Shah <snehilshah.989@gmail.com>
Reviewed-by: Philipp Burckhardt <pburckhardt@outlook.com>
  • Loading branch information
Snehil-Shah authored and aman-095 committed Jun 13, 2024
1 parent 7eb03ba commit 87ae4d8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/node_modules/@stdlib/repl/lib/output_stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ setNonEnumerableReadOnly( OutputStream.prototype, '_pagerHeight', function pager
if ( vh < MIN_VIEWPORT_HEIGHT ) {
return -1;
}
return vh - RESERVED_PAGING_ROWS;
return vh - RESERVED_PAGING_ROWS; // FIXME: reserved paging rows being a constant assumes that the input prompt spans just 1 row. This might not be the case with multi-line inputs triggering the pager as it will result in an incomplete UI with only the last line of the multi-line input visible in the pager view.
});

/**
Expand All @@ -285,8 +285,8 @@ setNonEnumerableReadOnly( OutputStream.prototype, '_pagerHeight', function pager
* @returns {boolean} boolean indicating whether content is "scrollable"
*/
setNonEnumerableReadOnly( OutputStream.prototype, '_isScrollable', function isScrollable( N ) {
var h = this._pagerHeight();
return ( h > 0 && N > h );
var vh = this._repl.viewportHeight();
return ( vh >= MIN_VIEWPORT_HEIGHT && N > vh - 2 ); // 2 rows reserved for the input and the next prompt
});

/**
Expand Down

0 comments on commit 87ae4d8

Please # to comment.