Skip to content

Commit 0e4b323

Browse files
committed
make sure to restore diff editor focus after repositioning the zone widget
fixes microsoft/vscode-internalbacklog#3964
1 parent 479e63a commit 0e4b323

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/vs/workbench/contrib/interactiveEditor/browser/interactiveEditorDiffWidget.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,15 @@ export class InteractiveEditorDiffWidget extends ZoneWidget {
116116

117117
this._sessionStore.add(this._diffEditor.onDidUpdateDiff(() => {
118118
const result = this._diffEditor.getDiffComputationResult();
119+
const hasFocus = this._diffEditor.hasTextFocus();
119120
this._doShowForChanges(range(), result?.changes2 ?? []);
121+
// TODO@jrieken find a better fix for this. this is the challenge:
122+
// the _doShowForChanges method invokes show of the zone widget which removes and adds the
123+
// zone and overlay parts. this dettaches and reattaches the dom nodes which means they lose
124+
// focus
125+
if (hasFocus) {
126+
this._diffEditor.focus();
127+
}
120128
}));
121129
this._doShowForChanges(range(), changes);
122130
}

0 commit comments

Comments
 (0)