Skip to content

Commit 4be533f

Browse files
authored
Endless loop in "Open Next/Previous Editor" (fix microsoft#159251) (microsoft#159252)
1 parent 35b971c commit 4be533f

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/vs/workbench/browser/parts/editor/editorActions.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1133,10 +1133,13 @@ export class OpenNextEditor extends AbstractNavigateEditorAction {
11331133
}
11341134

11351135
// Otherwise try in next group that has editors
1136+
const handledGroups = new Set<number>();
11361137
let currentGroup: IEditorGroup | undefined = this.editorGroupService.activeGroup;
1137-
while (currentGroup) {
1138+
while (currentGroup && !handledGroups.has(currentGroup.id)) {
11381139
currentGroup = this.editorGroupService.findGroup({ location: GroupLocation.NEXT }, currentGroup, true);
11391140
if (currentGroup) {
1141+
handledGroups.add(currentGroup.id);
1142+
11401143
const groupEditors = currentGroup.getEditors(EditorsOrder.SEQUENTIAL);
11411144
if (groupEditors.length > 0) {
11421145
return { editor: groupEditors[0], groupId: currentGroup.id };
@@ -1173,10 +1176,13 @@ export class OpenPreviousEditor extends AbstractNavigateEditorAction {
11731176
}
11741177

11751178
// Otherwise try in previous group that has editors
1179+
const handledGroups = new Set<number>();
11761180
let currentGroup: IEditorGroup | undefined = this.editorGroupService.activeGroup;
1177-
while (currentGroup) {
1181+
while (currentGroup && !handledGroups.has(currentGroup.id)) {
11781182
currentGroup = this.editorGroupService.findGroup({ location: GroupLocation.PREVIOUS }, currentGroup, true);
11791183
if (currentGroup) {
1184+
handledGroups.add(currentGroup.id);
1185+
11801186
const groupEditors = currentGroup.getEditors(EditorsOrder.SEQUENTIAL);
11811187
if (groupEditors.length > 0) {
11821188
return { editor: groupEditors[groupEditors.length - 1], groupId: currentGroup.id };

0 commit comments

Comments
 (0)