Fix "Go to..." dialog wrong Offset value in empty files

Fix #9145
This commit is contained in:
Don HO 2020-11-14 11:34:19 +01:00
parent 26428bd2ba
commit daa31c1a9a
No known key found for this signature in database
GPG Key ID: 6C429F1D8D84F46E

View File

@ -108,6 +108,7 @@ INT_PTR CALLBACK GoToLineDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM)
updateLinesNumbers();
return TRUE;
}
default :
{
switch (HIWORD(wParam))
@ -142,7 +143,8 @@ void GoToLineDlg::updateLinesNumbers() const
else
{
current = static_cast<unsigned int>((*_ppEditView)->execute(SCI_GETCURRENTPOS));
limit = static_cast<unsigned int>((*_ppEditView)->getCurrentDocLen() - 1);
int currentDocLength = (*_ppEditView)->getCurrentDocLen();
limit = static_cast<unsigned int>(currentDocLength > 0 ? currentDocLength - 1 : 0);
}
::SetDlgItemInt(_hSelf, ID_CURRLINE, current, FALSE);
::SetDlgItemInt(_hSelf, ID_LASTLINE, limit, FALSE);