Skip to content

Commit e09eeb2

Browse files
authored
fix: update incorrect isScrollable constraints
PR-URL: #2293 Ref: #2149 Signed-off-by: Snehil Shah <snehilshah.989@gmail.com> Reviewed-by: Philipp Burckhardt <pburckhardt@outlook.com>
1 parent 133dd8b commit e09eeb2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/node_modules/@stdlib/repl/lib/output_stream.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ setNonEnumerableReadOnly( OutputStream.prototype, '_pagerHeight', function pager
271271
if ( vh < MIN_VIEWPORT_HEIGHT ) {
272272
return -1;
273273
}
274-
return vh - RESERVED_PAGING_ROWS;
274+
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.
275275
});
276276

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

292292
/**

0 commit comments

Comments
 (0)