@@ -9,7 +9,7 @@ import { Command } from "commander";
99import log from "../utils/log.js" ;
1010import { getBackspaceSequence , Shell } from "../utils/shell.js" ;
1111import { enableWin32InputMode , resetToInitialState } from "../utils/ansi.js" ;
12- import { MAX_LINES , type KeyPressEvent , type SuggestionManager } from "./suggestionManager.js" ;
12+ import { getMaxLines , type KeyPressEvent , type SuggestionManager } from "./suggestionManager.js" ;
1313import type { ISTerm } from "../isterm/pty.js" ;
1414import { v4 as uuidV4 } from "uuid" ;
1515
@@ -30,7 +30,7 @@ const writeOutput = (data: string) => {
3030const _render = ( term : ISTerm , suggestionManager : SuggestionManager , data : string , handlingBackspace : boolean , handlingSuggestion : boolean ) : boolean => {
3131 const direction = _direction ( term ) ;
3232 const { hidden : cursorHidden , shift : cursorShift } = term . getCursorState ( ) ;
33- const linesOfInterest = MAX_LINES ;
33+ const linesOfInterest = getMaxLines ( ) ;
3434
3535 const suggestion = suggestionManager . render ( direction ) ;
3636 const hasSuggestion = suggestion . length != 0 ;
@@ -60,18 +60,18 @@ const _render = (term: ISTerm, suggestionManager: SuggestionManager, data: strin
6060const _clear = ( term : ISTerm ) : void => {
6161 const clearDirection = _direction ( term ) == "above" ? "below" : "above" ; // invert direction to clear what was previously rendered
6262 const { hidden : cursorHidden } = term . getCursorState ( ) ;
63- const patch = term . getPatch ( MAX_LINES , [ ] , clearDirection ) ;
63+ const patch = term . getPatch ( getMaxLines ( ) , [ ] , clearDirection ) ;
6464
6565 const ansiCursorShow = cursorHidden ? "" : ansi . cursorShow ;
6666 if ( clearDirection == "above" ) {
67- writeOutput ( ansi . cursorHide + ansi . cursorSavePosition + ansi . cursorPrevLine . repeat ( MAX_LINES ) + patch + ansi . cursorRestorePosition + ansiCursorShow ) ;
67+ writeOutput ( ansi . cursorHide + ansi . cursorSavePosition + ansi . cursorPrevLine . repeat ( getMaxLines ( ) ) + patch + ansi . cursorRestorePosition + ansiCursorShow ) ;
6868 } else {
6969 writeOutput ( ansi . cursorHide + ansi . cursorSavePosition + ansi . cursorNextLine + patch + ansi . cursorRestorePosition + ansiCursorShow ) ;
7070 }
7171} ;
7272
7373const _direction = ( term : ISTerm ) : "above" | "below" => {
74- return term . getCursorState ( ) . remainingLines > MAX_LINES ? "below" : "above" ;
74+ return term . getCursorState ( ) . remainingLines > getMaxLines ( ) ? "below" : "above" ;
7575} ;
7676
7777export const render = async ( program : Command , shell : Shell , underTest : boolean , login : boolean ) => {
0 commit comments