Fix a regression regarding notepad replacement issue

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
pull/6222/head
Rajendra Singh 5 years ago committed by Don HO
parent a739eade8e
commit c16f7bbc1e
No known key found for this signature in database
GPG Key ID: 6C429F1D8D84F46E

@ -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;

Loading…
Cancel
Save