diff --git a/bin/win/elevator.exe b/bin/win/elevator.exe index 1f04f3f3d480..8e04f0477a0b 100644 Binary files a/bin/win/elevator.exe and b/bin/win/elevator.exe differ diff --git a/native/WinElevator/elevator/elevator.c b/native/WinElevator/elevator/elevator.c index bad1ed9b0f2c..0fd99fd6d8e7 100644 --- a/native/WinElevator/elevator/elevator.c +++ b/native/WinElevator/elevator/elevator.c @@ -53,13 +53,7 @@ static DWORD _ConnectIfNeededPipe(DWORD nParentPid, DWORD nDescriptor, FILE* str if (!SetHandleInformation(hPipe, HANDLE_FLAG_INHERIT, TRUE)) { return GetLastError(); - } - - // Fix CRT - if (_dup2(_open_osfhandle((intptr_t)hPipe, _O_WTEXT | _O_TEXT), _fileno(stream)) != 0) - { - return errno; - } + } // Fix Win32API DWORD hStdHandleToChange = ELEV_DESCR_GET_HANDLE(nDescriptor); diff --git a/platform/core-api/src/com/intellij/psi/util/PsiTreeUtil.java b/platform/core-api/src/com/intellij/psi/util/PsiTreeUtil.java index ed907a2b696d..78ff118edeeb 100644 --- a/platform/core-api/src/com/intellij/psi/util/PsiTreeUtil.java +++ b/platform/core-api/src/com/intellij/psi/util/PsiTreeUtil.java @@ -30,7 +30,9 @@ import com.intellij.psi.search.PsiElementProcessor.FindElement; import com.intellij.psi.stubs.StubBase; import com.intellij.psi.stubs.StubElement; import com.intellij.psi.templateLanguages.OuterLanguageElement; +import com.intellij.psi.tree.IElementType; import com.intellij.util.ArrayUtil; +import com.intellij.util.Consumer; import com.intellij.util.PairProcessor; import com.intellij.util.SmartList; import com.intellij.util.containers.ContainerUtil; @@ -661,6 +663,32 @@ public class PsiTreeUtil { return (T)element; } + @Nullable + public static PsiElement findSiblingForward(@NotNull final PsiElement element, + @NotNull final IElementType elementType, + @Nullable final Consumer consumer) { + for (PsiElement e = element.getNextSibling(); e != null; e = e.getNextSibling()) { + if (elementType.equals(e.getNode().getElementType())) { + return e; + } + if (consumer != null) consumer.consume(e); + } + return null; + } + + @Nullable + public static PsiElement findSiblingBackward(@NotNull final PsiElement element, + @NotNull final IElementType elementType, + @Nullable final Consumer consumer) { + for (PsiElement e = element.getPrevSibling(); e != null; e = e.getPrevSibling()) { + if (elementType.equals(e.getNode().getElementType())) { + return e; + } + if (consumer != null) consumer.consume(e); + } + return null; + } + @Nullable @Contract("null, _ -> null") public static PsiElement skipSiblingsForward(@Nullable PsiElement element, @NotNull Class... elementClasses) {