Skip to content

Commit 9f2fcb6

Browse files
authored
Prevent clear from flashing in terminal sticky scroll (microsoft#268921)
* Allow canceling of debounce for _show * Polish * Still no luck with RunOnceScheduler, clear always tries to show itself before the second hide * Just don't show sticky UI for clear command * Pass command object in _isClearCommand * Last Polish
1 parent 3b85948 commit 9f2fcb6

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

src/vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminalStickyScrollOverlay.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,8 @@ export class TerminalStickyScrollOverlay extends Disposable {
227227
// scroll.
228228
this._currentStickyCommand = undefined;
229229

230-
// No command
231-
if (!command) {
230+
// No command or clear command
231+
if (!command || this._isClearCommand(command)) {
232232
this._setVisible(false);
233233
return;
234234
}
@@ -521,6 +521,20 @@ export class TerminalStickyScrollOverlay extends Disposable {
521521
selectionInactiveBackground: undefined
522522
};
523523
}
524+
525+
private _isClearCommand(command: ITerminalCommand | ICurrentPartialCommand): boolean {
526+
if (!command.command) {
527+
return false;
528+
}
529+
const trimmedCommand = command.command.trim().toLowerCase();
530+
const clearCommands = [
531+
'clear',
532+
'cls',
533+
'clear-host',
534+
];
535+
536+
return clearCommands.includes(trimmedCommand);
537+
}
524538
}
525539

526540
function lineStartsWith(line: IBufferLine | undefined, text: string): boolean {

0 commit comments

Comments
 (0)