Disallow Goto dlg offset option from moving to position inside multibyte char or between CR and LF
Fix #9101, fix #9125, close #9129
This commit is contained in:
parent
f75f8b8d40
commit
f027e9271d
@ -62,11 +62,19 @@ INT_PTR CALLBACK GoToLineDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto sci_line = (*_ppEditView)->execute(SCI_LINEFROMPOSITION, line);
|
int posToGoto = 0;
|
||||||
|
if (line > 0)
|
||||||
|
{
|
||||||
|
// make sure not jumping into the middle of a multibyte character
|
||||||
|
// or into the middle of a CR/LF pair for Windows files
|
||||||
|
auto before = (*_ppEditView)->execute(SCI_POSITIONBEFORE, line);
|
||||||
|
posToGoto = static_cast<int>((*_ppEditView)->execute(SCI_POSITIONAFTER, before));
|
||||||
|
}
|
||||||
|
auto sci_line = (*_ppEditView)->execute(SCI_LINEFROMPOSITION, posToGoto);
|
||||||
(*_ppEditView)->execute(SCI_ENSUREVISIBLE, sci_line);
|
(*_ppEditView)->execute(SCI_ENSUREVISIBLE, sci_line);
|
||||||
(*_ppEditView)->execute(SCI_GOTOPOS, line);
|
(*_ppEditView)->execute(SCI_GOTOPOS, posToGoto);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SCNotification notification = {};
|
SCNotification notification = {};
|
||||||
notification.nmhdr.code = SCN_PAINTED;
|
notification.nmhdr.code = SCN_PAINTED;
|
||||||
|
Loading…
Reference in New Issue
Block a user