Skip to content

Commit d660621

Browse files
author
Pascal Fong Kye
committed
Dynamic layout
Use fixed size when pane grows instead of flex to avoid flickering
1 parent 55ec233 commit d660621

3 files changed

Lines changed: 35 additions & 1 deletion

File tree

src/vs/workbench/contrib/debug/browser/media/repl.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,10 @@
119119
margin-right: 10px;
120120
}
121121

122+
.panel > .title .monaco-action-bar .action-item.repl-panel-filter-container.grow {
123+
width: 400px;
124+
}
125+
122126
.repl-panel-filter-container .repl-panel-filter-controls {
123127
position: absolute;
124128
top: 0px;

src/vs/workbench/contrib/debug/browser/repl.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,7 @@ export class Repl extends ViewPane implements IHistoryNavigationWidget {
447447
protected layoutBody(height: number, width: number): void {
448448
super.layoutBody(height, width);
449449
this.dimension = new dom.Dimension(width, height);
450+
this.filterState.layout = this.dimension;
450451
const replInputHeight = Math.min(this.replInput.getContentHeight(), height);
451452
if (this.tree) {
452453
const lastElementVisible = this.tree.scrollTop + this.tree.renderHeight >= this.tree.scrollHeight;

src/vs/workbench/contrib/debug/browser/replFilter.ts

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,14 @@ export class ReplFilterState {
9191
return this._onDidStatsChange.event;
9292
}
9393

94+
private readonly _onDidLayoutChange: Emitter<void> = new Emitter<void>();
95+
get onDidLayoutChange(): Event<void> {
96+
return this._onDidLayoutChange.event;
97+
}
98+
9499
private _filterText = '';
95100
private _stats = { total: 0, filtered: 0 };
101+
private _layout = new DOM.Dimension(0, 0);
96102

97103
get filterText(): string {
98104
return this._filterText;
@@ -116,6 +122,17 @@ export class ReplFilterState {
116122
this._onDidChange.fire();
117123
}
118124
}
125+
126+
get layout(): DOM.Dimension {
127+
return this._layout;
128+
}
129+
130+
set layout(layout: DOM.Dimension) {
131+
if (this._layout.width !== layout.width || this._layout.height !== layout.height) {
132+
this._layout = layout;
133+
this._onDidLayoutChange.fire();
134+
}
135+
}
119136
}
120137

121138
export class ReplFilterActionViewItem extends BaseActionViewItem {
@@ -168,6 +185,7 @@ export class ReplFilterActionViewItem extends BaseActionViewItem {
168185
this._register(this.filters.onDidChange(() => {
169186
this.filterInputBox.value = this.filters.filterText;
170187
}));
188+
this._register(this.filters.onDidLayoutChange(() => { this.updateClass(); }));
171189
this._register(DOM.addStandardDisposableListener(this.filterInputBox.inputElement, DOM.EventType.KEY_DOWN, (e: any) => this.onInputKeyDown(e)));
172190
this._register(DOM.addStandardDisposableListener(container, DOM.EventType.KEY_DOWN, this.handleKeyboardEvent));
173191
this._register(DOM.addStandardDisposableListener(container, DOM.EventType.KEY_UP, this.handleKeyboardEvent));
@@ -232,7 +250,18 @@ export class ReplFilterActionViewItem extends BaseActionViewItem {
232250
}
233251
}
234252

253+
protected updateClass(): void {
254+
if (this.element && this.container) {
255+
this.element.className = this.class;
256+
this.container.classList.toggle('grow', this.element.classList.contains('grow'));
257+
}
258+
}
259+
235260
protected get class(): string {
236-
return 'panel-action-tree-filter';
261+
if (this.filters.layout.width > 600) {
262+
return 'panel-action-tree-filter grow';
263+
} else {
264+
return 'panel-action-tree-filter';
265+
}
237266
}
238267
}

0 commit comments

Comments
 (0)