diff --git a/src/isterm/commandManager.ts b/src/isterm/commandManager.ts index 3503c85..4a3efbb 100644 --- a/src/isterm/commandManager.ts +++ b/src/isterm/commandManager.ts @@ -46,6 +46,9 @@ export class CommandManager { } } handlePromptStart() { + if (this.#activeCommand.promptStartMarker?.line == -1) { + this.#previousCommandLines = new Set(); + } this.#activeCommand = { promptStartMarker: this.#terminal.registerMarker(0), hasOutput: false, cursorTerminated: false }; } diff --git a/src/ui/ui-root.ts b/src/ui/ui-root.ts index c8574bd..787b8f8 100644 --- a/src/ui/ui-root.ts +++ b/src/ui/ui-root.ts @@ -36,6 +36,10 @@ export const render = async (shell: Shell) => { const newlines = Math.max((data.match(/\r/g) || []).length, (data.match(/\n/g) || []).length); const linesOfInterest = MAX_LINES + newlines; if (term.getCursorState().remainingLines <= previousSuggestionsRows) { + // handles when suggestions get loaded before shell output so you need to always clear below output as a precaution + if (term.getCursorState().remainingLines != 0) { + writeOutput(ansi.cursorHide + ansi.cursorSavePosition + eraseLinesBelow(linesOfInterest + 1) + ansi.cursorRestorePosition); + } writeOutput( data + ansi.cursorHide +