Skip to content

Commit

Permalink
Fix a regression regarding notepad replacement issue
Browse files Browse the repository at this point in the history
Fixed command line parsing logic error.

Root cause:
When you double click a file (where NPP has already replaced original Windows Notepad.exe) command like something like below is generated -

-notepadStyleCmdline -z "C:\WINDOWS\system32\NOTEPAD.EXE" F:\FakePath\PowerEditor\bin\change.log

After processing this command line, final command line is left as " F:\FakePath\PowerEditor\bin\change.log while others are ignored. Notice, quote " here just before the actual file path.

Later on, MS PAI ::PathIsRelative treats it as relative path because of quote " rather considering single file. It is expected too as per input to this API.

Now, notepad++ tries to open all the file from path F:\FakePath\PowerEditor\bin\ (in above case) along with file F:\FakePath\PowerEditor\bin\change.log.

Close #6215, fix #6211
  • Loading branch information
SinghRajenM authored and donho committed Oct 14, 2019
1 parent a739ead commit c16f7bb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions PowerEditor/src/winmain.cpp
Expand Up @@ -299,8 +299,8 @@ PWSTR advanceCmdLine(PWSTR pCmdLine, const generic_string& string)
}

// Match the substring only if it matched an entire substring
if ( (ignoredString == pCmdLine || iswspace(*(ignoredString-1)) ) && // Check start
(iswspace(*(ignoredString+len)) || *(ignoredString+len) == '\0') )
if ((ignoredString == pCmdLine || iswspace(*(ignoredString - 1))) && // Check start
(iswspace(*(ignoredString + len)) || *(ignoredString + len) == '\0' || *(ignoredString + len) == '"'))
{
ignoredString += len;

Expand Down

0 comments on commit c16f7bb

Please sign in to comment.