From 513ee3e3feae9e43af4fcf938b2b7acd064c693b Mon Sep 17 00:00:00 2001 From: Don Ho Date: Sun, 30 Oct 2022 01:09:28 +0200 Subject: [PATCH] Use Scitilla default 64 bits symbol --- PowerEditor/src/Notepad_plus.cpp | 2 +- PowerEditor/src/Notepad_plus.h | 2 +- PowerEditor/src/NppCommands.cpp | 6 +-- .../src/ScintillaComponent/FindReplaceDlg.cpp | 16 ++++---- .../ScintillaComponent/ScintillaEditView.cpp | 38 +++++++++---------- .../ScintillaComponent/ScintillaEditView.h | 14 +++---- 6 files changed, 39 insertions(+), 39 deletions(-) diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index ba9eab507..df951e6d6 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -1993,7 +1993,7 @@ bool Notepad_plus::findInCurrentFile(bool isEntireDoc) int nbTotal = 0; Buffer * pBuf = _pEditView->getCurrentBuffer(); - Sci_CharacterRange mainSelection = _pEditView->getSelection(); // remember selection before switching view + Sci_CharacterRangeFull mainSelection = _pEditView->getSelection(); // remember selection before switching view ScintillaEditView *pOldView = _pEditView; _pEditView = &_invisibleEditView; diff --git a/PowerEditor/src/Notepad_plus.h b/PowerEditor/src/Notepad_plus.h index 7e853d609..4d90ee780 100644 --- a/PowerEditor/src/Notepad_plus.h +++ b/PowerEditor/src/Notepad_plus.h @@ -355,7 +355,7 @@ private: bool _isFolding = false; //For Dynamic selection highlight - Sci_CharacterRange _prevSelectedRange; + Sci_CharacterRangeFull _prevSelectedRange; //Synchronized Scolling struct SyncInfo final diff --git a/PowerEditor/src/NppCommands.cpp b/PowerEditor/src/NppCommands.cpp index c27defe39..29f1819fa 100644 --- a/PowerEditor/src/NppCommands.cpp +++ b/PowerEditor/src/NppCommands.cpp @@ -1440,12 +1440,12 @@ void Notepad_plus::command(int id) else // (id == IDM_SEARCH_MARKONEEXT5) styleID = SCE_UNIVERSAL_FOUND_STYLE_EXT5; - Sci_CharacterRange range = _pEditView->getSelection(); + Sci_CharacterRangeFull range = _pEditView->getSelection(); if (range.cpMin == range.cpMax) { auto caretPos = _pEditView->execute(SCI_GETCURRENTPOS, 0, 0); - range.cpMin = static_cast(_pEditView->execute(SCI_WORDSTARTPOSITION, caretPos, true)); - range.cpMax = static_cast(_pEditView->execute(SCI_WORDENDPOSITION, caretPos, true)); + range.cpMin = _pEditView->execute(SCI_WORDSTARTPOSITION, caretPos, true); + range.cpMax = _pEditView->execute(SCI_WORDENDPOSITION, caretPos, true); } if (range.cpMax > range.cpMin) { diff --git a/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp b/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp index 97d3422ab..332eb2bf5 100644 --- a/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp +++ b/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp @@ -1428,7 +1428,7 @@ intptr_t CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARA { if (LOWORD(wParam) == WA_ACTIVE || LOWORD(wParam) == WA_CLICKACTIVE) { - Sci_CharacterRange cr = (*_ppEditView)->getSelection(); + Sci_CharacterRangeFull cr = (*_ppEditView)->getSelection(); intptr_t nbSelected = cr.cpMax - cr.cpMin; _options._isInSelection = isCheckedOrNot(IDC_IN_SELECTION_CHECK)?1:0; @@ -2256,7 +2256,7 @@ bool FindReplaceDlg::processFindNext(const TCHAR *txt2find, const FindOption *op } intptr_t docLength = (*_ppEditView)->execute(SCI_GETLENGTH); - Sci_CharacterRange cr = (*_ppEditView)->getSelection(); + Sci_CharacterRangeFull cr = (*_ppEditView)->getSelection(); //The search "zone" is relative to the selection, so search happens 'outside' @@ -2445,13 +2445,13 @@ bool FindReplaceDlg::processReplace(const TCHAR *txt2find, const TCHAR *txt2repl FindOption replaceOptions = options ? *options : *_env; replaceOptions._incrementalType = FirstIncremental; - Sci_CharacterRange currentSelection = (*_ppEditView)->getSelection(); + Sci_CharacterRangeFull currentSelection = (*_ppEditView)->getSelection(); FindStatus status; moreMatches = processFindNext(txt2find, &replaceOptions, &status, FINDNEXTTYPE_FINDNEXTFORREPLACE); if (moreMatches) { - Sci_CharacterRange nextFind = (*_ppEditView)->getSelection(); + Sci_CharacterRangeFull nextFind = (*_ppEditView)->getSelection(); // If the next find is the same as the last, then perform the replacement if (nextFind.cpMin == currentSelection.cpMin && nextFind.cpMax == currentSelection.cpMax) @@ -2567,7 +2567,7 @@ int FindReplaceDlg::processAll(ProcessOperation op, const FindOption *opt, bool const TCHAR *txt2find = pOptions->_str2Search.c_str(); const TCHAR *txt2replace = pOptions->_str4Replace.c_str(); - Sci_CharacterRange cr = (*_ppEditView)->getSelection(); + Sci_CharacterRangeFull cr = (*_ppEditView)->getSelection(); size_t docLength = (*_ppEditView)->execute(SCI_GETLENGTH); // Default : @@ -3825,7 +3825,7 @@ void FindReplaceDlg::clearMarks(const FindOption& opt) { if (opt._isInSelection) { - Sci_CharacterRange cr = (*_ppEditView)->getSelection(); + Sci_CharacterRangeFull cr = (*_ppEditView)->getSelection(); intptr_t startPosition = cr.cpMin; intptr_t endPosition = cr.cpMax; @@ -5178,7 +5178,7 @@ intptr_t CALLBACK FindIncrementDlg::run_dlgProc(UINT message, WPARAM wParam, LPA // selected (no change, if there was no selection) if (updateCase && !isFound) { - Sci_CharacterRange range = (*(_pFRDlg->_ppEditView))->getSelection(); + Sci_CharacterRangeFull range = (*(_pFRDlg->_ppEditView))->getSelection(); (*(_pFRDlg->_ppEditView))->execute(SCI_SETSEL, static_cast(-1), range.cpMin); } } @@ -5226,7 +5226,7 @@ void FindIncrementDlg::markSelectedTextInc(bool enable, FindOption *opt) return; //Get selection - Sci_CharacterRange range = (*(_pFRDlg->_ppEditView))->getSelection(); + Sci_CharacterRangeFull range = (*(_pFRDlg->_ppEditView))->getSelection(); //If nothing selected, dont mark anything if (range.cpMin == range.cpMax) diff --git a/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp b/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp index dbb43c598..4933b438e 100644 --- a/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp +++ b/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp @@ -415,7 +415,7 @@ LRESULT ScintillaEditView::scintillaNew_Proc(HWND hwnd, UINT Message, WPARAM wPa // get the current text selection - Sci_CharacterRange range = getSelection(); + Sci_CharacterRangeFull range = getSelection(); if (range.cpMax == range.cpMin) { // no selection: select the current word instead @@ -2379,15 +2379,15 @@ char * ScintillaEditView::getSelectedText(char * txt, size_t size, bool expand) { if (!size) return NULL; - Sci_CharacterRange range = getSelection(); + Sci_CharacterRangeFull range = getSelection(); if (range.cpMax == range.cpMin && expand) { expandWordSelection(); range = getSelection(); } - if (!(static_cast(size) > (range.cpMax - range.cpMin))) //there must be atleast 1 byte left for zero terminator + if (!(static_cast(size) > (range.cpMax - range.cpMin))) //there must be atleast 1 byte left for zero terminator { - range.cpMax = range.cpMin + (Sci_PositionCR)size -1; //keep room for zero terminator + range.cpMax = range.cpMin + size -1; //keep room for zero terminator } //getText(txt, range.cpMin, range.cpMax); return getWordFromRange(txt, size, range.cpMin, range.cpMax); @@ -2790,40 +2790,40 @@ void ScintillaEditView::showIndentGuideLine(bool willBeShowed) void ScintillaEditView::setLineIndent(size_t line, size_t indent) const { - Sci_CharacterRange crange = getSelection(); - size_t posBefore = execute(SCI_GETLINEINDENTPOSITION, line); + Sci_CharacterRangeFull crange = getSelection(); + int64_t posBefore = execute(SCI_GETLINEINDENTPOSITION, line); execute(SCI_SETLINEINDENTATION, line, indent); - size_t posAfter = execute(SCI_GETLINEINDENTPOSITION, line); + int64_t posAfter = execute(SCI_GETLINEINDENTPOSITION, line); long long posDifference = posAfter - posBefore; if (posAfter > posBefore) { // Move selection on - if (crange.cpMin >= static_cast(posBefore)) + if (crange.cpMin >= posBefore) { - crange.cpMin += static_cast(posDifference); + crange.cpMin += posDifference; } - if (crange.cpMax >= static_cast(posBefore)) + if (crange.cpMax >= posBefore) { - crange.cpMax += static_cast(posDifference); + crange.cpMax += posDifference; } } else if (posAfter < posBefore) { // Move selection back - if (crange.cpMin >= static_cast(posAfter)) + if (crange.cpMin >= posAfter) { - if (crange.cpMin >= static_cast(posBefore)) - crange.cpMin += static_cast(posDifference); + if (crange.cpMin >= posBefore) + crange.cpMin += posDifference; else - crange.cpMin = static_cast(posAfter); + crange.cpMin = posAfter; } - if (crange.cpMax >= static_cast(posAfter)) + if (crange.cpMax >= posAfter) { - if (crange.cpMax >= static_cast(posBefore)) - crange.cpMax += static_cast(posDifference); + if (crange.cpMax >= posBefore) + crange.cpMax += posDifference; else - crange.cpMax = static_cast(posAfter); + crange.cpMax = posAfter; } } execute(SCI_SETSEL, crange.cpMin, crange.cpMax); diff --git a/PowerEditor/src/ScintillaComponent/ScintillaEditView.h b/PowerEditor/src/ScintillaComponent/ScintillaEditView.h index 4c5d4c10e..2295b9864 100644 --- a/PowerEditor/src/ScintillaComponent/ScintillaEditView.h +++ b/PowerEditor/src/ScintillaComponent/ScintillaEditView.h @@ -233,7 +233,7 @@ public: void replaceSelWith(const char * replaceText); intptr_t getSelectedTextCount() { - Sci_CharacterRange range = getSelection(); + Sci_CharacterRangeFull range = getSelection(); return (range.cpMax - range.cpMin); }; @@ -271,10 +271,10 @@ public: return size_t(execute(SCI_GETLENGTH)); }; - Sci_CharacterRange getSelection() const { - Sci_CharacterRange crange{}; - crange.cpMin = static_cast(execute(SCI_GETSELECTIONSTART)); - crange.cpMax = static_cast(execute(SCI_GETSELECTIONEND)); + Sci_CharacterRangeFull getSelection() const { + Sci_CharacterRangeFull crange{}; + crange.cpMin = execute(SCI_GETSELECTIONSTART); + crange.cpMax = execute(SCI_GETSELECTIONEND); return crange; }; @@ -543,8 +543,8 @@ public: void runMarkers(bool doHide, size_t searchStart, bool endOfDoc, bool doDelete); bool isSelecting() const { - static Sci_CharacterRange previousSelRange = getSelection(); - Sci_CharacterRange currentSelRange = getSelection(); + static Sci_CharacterRangeFull previousSelRange = getSelection(); + Sci_CharacterRangeFull currentSelRange = getSelection(); if (currentSelRange.cpMin == currentSelRange.cpMax) {