Make Sci_PositionCR 64 bits in x64 build

This commit is contained in:
Don Ho 2022-01-22 02:20:58 +01:00
parent 66789aba2e
commit d6e8a7c168
5 changed files with 14 additions and 8 deletions

View File

@ -1115,7 +1115,7 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
if (LOWORD(wParam) == WA_ACTIVE || LOWORD(wParam) == WA_CLICKACTIVE)
{
Sci_CharacterRange cr = (*_ppEditView)->getSelection();
int nbSelected = cr.cpMax - cr.cpMin;
INT_PTR nbSelected = cr.cpMax - cr.cpMin;
_options._isInSelection = isCheckedOrNot(IDC_IN_SELECTION_CHECK)?1:0;
int checkVal = _options._isInSelection?BST_CHECKED:BST_UNCHECKED;
@ -3433,8 +3433,8 @@ void FindReplaceDlg::clearMarks(const FindOption& opt)
{
Sci_CharacterRange cr = (*_ppEditView)->getSelection();
int startPosition = cr.cpMin;
int endPosition = cr.cpMax;
INT_PTR startPosition = cr.cpMin;
INT_PTR endPosition = cr.cpMax;
(*_ppEditView)->execute(SCI_SETINDICATORCURRENT, SCE_UNIVERSAL_FOUND_STYLE);
(*_ppEditView)->execute(SCI_INDICATORCLEARRANGE, startPosition, endPosition - startPosition);

View File

@ -387,7 +387,7 @@ LRESULT ScintillaEditView::scintillaNew_Proc(HWND hwnd, UINT Message, WPARAM wPa
if (wParam == IMR_RECONVERTSTRING)
{
INT_PTR textLength;
int selectSize;
INT_PTR selectSize;
char smallTextBuffer[128];
char * selectedStr = smallTextBuffer;
RECONVERTSTRING * reconvert = (RECONVERTSTRING *)lParam;
@ -426,7 +426,7 @@ LRESULT ScintillaEditView::scintillaNew_Proc(HWND hwnd, UINT Message, WPARAM wPa
{
// convert the selection to Unicode, and get the number
// of bytes required for the converted text
textLength = sizeof(WCHAR) * ::MultiByteToWideChar(codepage, 0, selectedStr, selectSize, NULL, 0);
textLength = sizeof(WCHAR) * ::MultiByteToWideChar(codepage, 0, selectedStr, (int)selectSize, NULL, 0);
}
else
{
@ -436,7 +436,7 @@ LRESULT ScintillaEditView::scintillaNew_Proc(HWND hwnd, UINT Message, WPARAM wPa
// dwCompStrOffset, and dwTargetStrOffset specify byte counts.
textLength = ::MultiByteToWideChar( codepage, 0,
selectedStr, selectSize,
selectedStr, (int)selectSize,
(LPWSTR)((LPSTR)reconvert + sizeof(RECONVERTSTRING)),
reconvert->dwSize - sizeof(RECONVERTSTRING));

View File

@ -234,7 +234,7 @@ public:
void insertGenericTextFrom(size_t position, const TCHAR *text2insert) const;
void replaceSelWith(const char * replaceText);
int getSelectedTextCount() {
INT_PTR getSelectedTextCount() {
Sci_CharacterRange range = getSelection();
return (range.cpMax - range.cpMin);
};

View File

@ -116,7 +116,7 @@ void SmartHighlighter::highlightView(ScintillaEditView * pHighlightView, Scintil
auto curPos = pHighlightView->execute(SCI_GETCURRENTPOS);
auto range = pHighlightView->getSelection();
int textlen = range.cpMax - range.cpMin;
INT_PTR textlen = range.cpMax - range.cpMin;
// Determine mode for SmartHighlighting
bool isWordOnly = true;

View File

@ -15,10 +15,16 @@
typedef ptrdiff_t Sci_Position;
// Unsigned variant used for ILexer::Lex and ILexer::Fold
// Definitions of common types
typedef size_t Sci_PositionU;
// For Sci_CharacterRange which is defined as long to be compatible with Win32 CHARRANGE
#ifdef _WIN64
typedef long long Sci_PositionCR;
#else
typedef long Sci_PositionCR;
#endif
#ifdef _WIN32
#define SCI_METHOD __stdcall