Fix bug where -p0 cmd line arg causes wrong positioning

Fixes small bug introduced by #9143.

Close #9150
This commit is contained in:
Scott Sumner 2020-11-14 08:19:51 -05:00 committed by Don HO
parent 9f8932b375
commit bfa44f5db3
No known key found for this signature in database
GPG Key ID: 6C429F1D8D84F46E

View File

@ -5925,10 +5925,13 @@ std::vector<generic_string> Notepad_plus::loadCommandlineParams(const TCHAR * co
if (cpos != -1) if (cpos != -1)
{ {
// make sure not jumping into the middle of a multibyte character if (cpos > 0)
// or into the middle of a CR/LF pair for Windows files {
auto before = _pEditView->execute(SCI_POSITIONBEFORE, cpos); // make sure not jumping into the middle of a multibyte character
cpos = static_cast<int>(_pEditView->execute(SCI_POSITIONAFTER, before)); // or into the middle of a CR/LF pair for Windows files
auto before = _pEditView->execute(SCI_POSITIONBEFORE, cpos);
cpos = static_cast<int>(_pEditView->execute(SCI_POSITIONAFTER, before));
}
_pEditView->execute(SCI_GOTOPOS, cpos); _pEditView->execute(SCI_GOTOPOS, cpos);
} }
else if (cn == -1) else if (cn == -1)