diff --git a/PowerEditor/src/ScintillaComponent/GoToLineDlg.cpp b/PowerEditor/src/ScintillaComponent/GoToLineDlg.cpp index dd6e20edc..77bace253 100644 --- a/PowerEditor/src/ScintillaComponent/GoToLineDlg.cpp +++ b/PowerEditor/src/ScintillaComponent/GoToLineDlg.cpp @@ -88,15 +88,15 @@ intptr_t CALLBACK GoToLineDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM) case IDOK : { - int line = getLine(); + long long line = getLine(); if (line != -1) { display(false); cleanLineEdit(); if (_mode == go2line) { - (*_ppEditView)->execute(SCI_ENSUREVISIBLE, line-1); - (*_ppEditView)->execute(SCI_GOTOLINE, line-1); + (*_ppEditView)->execute(SCI_ENSUREVISIBLE, static_cast(line - 1)); + (*_ppEditView)->execute(SCI_GOTOLINE, static_cast(line - 1)); } else { @@ -105,7 +105,7 @@ intptr_t CALLBACK GoToLineDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM) { // 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); + auto before = (*_ppEditView)->execute(SCI_POSITIONBEFORE, static_cast(line)); posToGoto = (*_ppEditView)->execute(SCI_POSITIONAFTER, before); } auto sci_line = (*_ppEditView)->execute(SCI_LINEFROMPOSITION, posToGoto); @@ -185,6 +185,8 @@ void GoToLineDlg::updateLinesNumbers() const size_t currentDocLength = (*_ppEditView)->getCurrentDocLen(); limit = (currentDocLength > 0 ? currentDocLength - 1 : 0); } - ::SetDlgItemInt(_hSelf, ID_CURRLINE, (UINT)current, FALSE); - ::SetDlgItemInt(_hSelf, ID_LASTLINE, (UINT)limit, FALSE); + + + ::SetDlgItemTextA(_hSelf, ID_CURRLINE, std::to_string(current).c_str()); + ::SetDlgItemTextA(_hSelf, ID_LASTLINE, std::to_string(limit).c_str()); } diff --git a/PowerEditor/src/ScintillaComponent/GoToLineDlg.h b/PowerEditor/src/ScintillaComponent/GoToLineDlg.h index dbe81558b..1a93f8ade 100644 --- a/PowerEditor/src/ScintillaComponent/GoToLineDlg.h +++ b/PowerEditor/src/ScintillaComponent/GoToLineDlg.h @@ -61,10 +61,14 @@ private : ::SetDlgItemText(_hSelf, ID_GOLINE_EDIT, TEXT("")); }; - int getLine() const { - BOOL isSuccessful; - int line = ::GetDlgItemInt(_hSelf, ID_GOLINE_EDIT, &isSuccessful, FALSE); - return (isSuccessful?line:-1); + long long getLine() const { + const int maxLen = 256; + char goLineEditStr[maxLen] = {'\0'}; + UINT count = ::GetDlgItemTextA(_hSelf, ID_GOLINE_EDIT, goLineEditStr, maxLen); + if (!count) + return -1; + char* p_end; + return strtoll(goLineEditStr, &p_end, 10); }; };