fix [VCS]: Improve changelist multi selection for Navigation in the diff view IJPL-247915

(cherry picked from commit ec54ba04205f301857629d2035408734faa99078)

GitOrigin-RevId: 25efc16a16908ba333198c41fd32fe7681538fb1
This commit is contained in:
Radu Nedelcu
2026-08-05 13:39:46 +00:00
committed by intellij-monorepo-bot
parent 2d58cf364f
commit d91574b5fe
@@ -260,7 +260,7 @@ public abstract class ChangeViewDiffRequestProcessor extends CacheDiffRequestPro
protected @Nullable AnAction createGoToChangeAction() {
Supplier<ListSelection<? extends Wrapper>> changesSupplier =
Registry.is("vcs.diff.preview.scope.navigation.to.group")
? this::getCurrentGroupListSelection
? this::getGroupOrMultiSelectionListSelection
: this::getChanges;
return PresentableGoToChangePopupAction.create(changesSupplier::get, new MyGoToChangePopupController());
}
@@ -273,11 +273,16 @@ public abstract class ChangeViewDiffRequestProcessor extends CacheDiffRequestPro
return Collections.emptyList();
}
private @NotNull ListSelection<? extends Wrapper> getCurrentGroupListSelection() {
private @NotNull ListSelection<? extends Wrapper> getGroupOrMultiSelectionListSelection() {
Wrapper currentChange = getCurrentChange();
if (currentChange == null) {
return ListSelection.empty();
}
// If there is an explicit multiple selection (2+ items), scope the navigation to it.
List<? extends Wrapper> selectedChanges = ContainerUtil.newArrayList(iterateSelectedChanges());
if (selectedChanges.size() > 1) {
return ListSelection.create(selectedChanges, currentChange);
}
List<? extends Wrapper> groupChanges = toListIfNotMany(iterateChangesInSameGroup(currentChange), true);
if (groupChanges == null) {
return ListSelection.empty();