fix: prompt detection on clears (#132)

Signed-off-by: Chapman Pendery <cpendery@vt.edu>
This commit is contained in:
Chapman Pendery
2023-12-19 21:04:01 -08:00
committed by GitHub
parent 724304cb85
commit e06b51e3cd
2 changed files with 7 additions and 0 deletions
+3
View File
@@ -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 };
}
+4
View File
@@ -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 +