From bdae2aef927c0ea80632daf051202ce9f794b9bd Mon Sep 17 00:00:00 2001 From: jofon <70416966+jofon@users.noreply.github.com> Date: Sat, 20 Mar 2021 17:02:01 +0000 Subject: [PATCH] Fix view file in Edge failure issue if name contains spaces Added Edge to the same case as the other browsers, which substitutes spaces for %20, and opens the files as expected and add legacy edge as a backup in case the new edge isn't found. Fix #9313, close #9677 --- PowerEditor/src/NppCommands.cpp | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/PowerEditor/src/NppCommands.cpp b/PowerEditor/src/NppCommands.cpp index 166ad8947..b54ff028f 100644 --- a/PowerEditor/src/NppCommands.cpp +++ b/PowerEditor/src/NppCommands.cpp @@ -1989,6 +1989,7 @@ void Notepad_plus::command(int id) case IDM_VIEW_IN_FIREFOX: case IDM_VIEW_IN_CHROME: + case IDM_VIEW_IN_EDGE: case IDM_VIEW_IN_IE: { auto currentBuf = _pEditView->getCurrentBuffer(); @@ -2004,6 +2005,10 @@ void Notepad_plus::command(int id) { appName = TEXT("chrome.exe"); } + else if (id == IDM_VIEW_IN_EDGE) + { + appName = TEXT("msedge.exe"); + } else // if (id == IDM_VIEW_IN_IE) { appName = TEXT("IEXPLORE.EXE"); @@ -2027,7 +2032,18 @@ void Notepad_plus::command(int id) { ::ShellExecute(NULL, TEXT("open"), valData, fullCurrentPath.c_str(), NULL, SW_SHOWNORMAL); } - else + else if (id == IDM_VIEW_IN_EDGE) + { + // Try the Legacy version + + // Don't put the quots for Edge, otherwise it doesn't work + //fullCurrentPath = TEXT("\""); + generic_string fullCurrentPath = currentBuf->getFullPathName(); + //fullCurrentPath += TEXT("\""); + + ::ShellExecute(NULL, TEXT("open"), TEXT("shell:Appsfolder\\Microsoft.MicrosoftEdge_8wekyb3d8bbwe!MicrosoftEdge"), fullCurrentPath.c_str(), NULL, SW_SHOW); + } + else { _nativeLangSpeaker.messageBox("ViewInBrowser", _pPublicInterface->getHSelf(), @@ -2039,21 +2055,6 @@ void Notepad_plus::command(int id) } } break; - - case IDM_VIEW_IN_EDGE: - { - auto currentBuf = _pEditView->getCurrentBuffer(); - if (!currentBuf->isUntitled()) - { - // Don't put the quots for Edge, otherwise it doesn't work - //fullCurrentPath = TEXT("\""); - generic_string fullCurrentPath = currentBuf->getFullPathName(); - //fullCurrentPath += TEXT("\""); - - ShellExecute(NULL, TEXT("open"), TEXT("shell:Appsfolder\\Microsoft.MicrosoftEdge_8wekyb3d8bbwe!MicrosoftEdge"), fullCurrentPath.c_str(), NULL, SW_SHOW); - } - } - break; case IDM_VIEW_TAB_SPACE: {