Skip to content

Commit

Permalink
testing: fix debounce terminal resizes (#187071)
Browse files Browse the repository at this point in the history
  • Loading branch information
connor4312 authored Jul 5, 2023
1 parent 6e60843 commit 8d7c5b9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
4 changes: 4 additions & 0 deletions src/vs/workbench/contrib/testing/browser/media/testing.css
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,10 @@
border-bottom-width: 2px;
}

.test-output-peek-message-container {
overflow: hidden;
}

.test-output-peek-message-container,
.test-output-peek-tree {
height: 100%;
Expand Down
14 changes: 9 additions & 5 deletions src/vs/workbench/contrib/testing/browser/testingOutputPeek.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { ICompressedTreeElement, ICompressedTreeNode } from 'vs/base/browser/ui/
import { ICompressibleTreeRenderer } from 'vs/base/browser/ui/tree/objectTree';
import { ITreeContextMenuEvent, ITreeNode } from 'vs/base/browser/ui/tree/tree';
import { Action, IAction, Separator } from 'vs/base/common/actions';
import { RunOnceScheduler } from 'vs/base/common/async';
import { Delayer, RunOnceScheduler } from 'vs/base/common/async';
import { Codicon } from 'vs/base/common/codicons';
import { Color } from 'vs/base/common/color';
import { Emitter, Event } from 'vs/base/common/event';
Expand Down Expand Up @@ -1228,6 +1228,7 @@ class PlainTextMessagePeek extends Disposable implements IPeekOutputRenderer {
class TerminalMessagePeek extends Disposable implements IPeekOutputRenderer {
private dimensions?: dom.IDimension;
private readonly terminalCwd = this._register(new MutableObservableValue<string>(''));
private readonly xtermLayoutDelayer = this._register(new Delayer(50));

/** Active terminal instance. */
private readonly terminal = this._register(new MutableDisposable<IDetachedXtermTerminal>());
Expand Down Expand Up @@ -1343,6 +1344,7 @@ class TerminalMessagePeek extends Disposable implements IPeekOutputRenderer {

private clear() {
this.outputDataListener.clear();
this.xtermLayoutDelayer.cancel();
this.terminal.clear();
}

Expand All @@ -1359,10 +1361,12 @@ class TerminalMessagePeek extends Disposable implements IPeekOutputRenderer {
height = this.dimensions?.height ?? this.container.clientHeight
) {
width -= 10 + 20; // scrollbar width + margin
const scaled = getXtermScaledDimensions(xterm.getFont(), width, height);
if (scaled) {
xterm.resize(scaled.cols, scaled.rows);
}
this.xtermLayoutDelayer.trigger(() => {
const scaled = getXtermScaledDimensions(xterm.getFont(), width, height);
if (scaled) {
xterm.resize(scaled.cols, scaled.rows);
}
});
}
}

Expand Down

0 comments on commit 8d7c5b9

Please sign in to comment.