Skip to content

Commit 890cc89

Browse files
committed
fix: Prevent flicker in search result updates
1 parent c022753 commit 890cc89

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/search.ts

+10-2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export class Search {
3333
private text: Clutter.Text;
3434
private widgets: Array<St.Widget>;
3535
private scroller: St.Widget;
36+
private children_to_abandon: any = null;
3637

3738
activate_id: (index: number) => void = () => {}
3839
cancel: () => void = () => {}
@@ -193,8 +194,7 @@ export class Search {
193194
}
194195

195196
clear() {
196-
this.list.remove_all_children();
197-
this.list.hide();
197+
this.children_to_abandon = (this.list as any).get_children();
198198
this.widgets = [];
199199
this.active_id = 0;
200200
}
@@ -299,6 +299,14 @@ export class Search {
299299

300300
this.widgets.push(widget);
301301
this.list.add(widget);
302+
303+
if (this.children_to_abandon) {
304+
for (const child of this.children_to_abandon) {
305+
child.destroy();
306+
}
307+
this.children_to_abandon = null
308+
}
309+
302310
this.list.show();
303311

304312
const vscroll = (this.scroller as any).get_vscroll_bar()

0 commit comments

Comments
 (0)