Upgrade Scintilla - Adaptation of PowerEditor part
This commit is contained in:
parent
2d90b38795
commit
d22d1609ab
@ -72,6 +72,14 @@ bool SecurityGard::checkModule(const std::wstring& filePath, NppModule module2ch
|
||||
|
||||
bool SecurityGard::checkSha256(const std::wstring& filePath, NppModule module2check)
|
||||
{
|
||||
// Uncomment the following code if the components are rebuilt for testing
|
||||
// It should be stay in commenting out
|
||||
/*
|
||||
bool dontCheck = true;
|
||||
if (dontCheck)
|
||||
return true;
|
||||
*/
|
||||
|
||||
std::string content = getFileContent(filePath.c_str());
|
||||
uint8_t sha2hash[32];
|
||||
calc_sha_256(sha2hash, reinterpret_cast<const uint8_t*>(content.c_str()), content.length());
|
||||
|
@ -349,7 +349,7 @@ private:
|
||||
bool _isFolding = false;
|
||||
|
||||
//For Dynamic selection highlight
|
||||
CharacterRange _prevSelectedRange;
|
||||
Sci_CharacterRange _prevSelectedRange;
|
||||
|
||||
//Synchronized Scolling
|
||||
struct SyncInfo final
|
||||
|
@ -612,7 +612,7 @@ BOOL Notepad_plus::notify(SCNotification *notification)
|
||||
{
|
||||
if ((notification->nmhdr.hwndFrom == _mainEditView.getHSelf()) || (notification->nmhdr.hwndFrom == _subEditView.getHSelf()))
|
||||
{
|
||||
int lineClicked = notification->line;
|
||||
size_t lineClicked = notification->line;
|
||||
|
||||
if (!_isFolding)
|
||||
{
|
||||
@ -997,21 +997,21 @@ BOOL Notepad_plus::notify(SCNotification *notification)
|
||||
if (not notifyView->execute(SCI_STYLEGETHOTSPOT, style))
|
||||
break;
|
||||
|
||||
int startPos, endPos, docLen;
|
||||
long long startPos, endPos, docLen;
|
||||
startPos = endPos = notification->position;
|
||||
docLen = notifyView->getCurrentDocLen();
|
||||
|
||||
// Walk backwards/forwards to get the contiguous text in the same style
|
||||
while (startPos > 0 && static_cast<uint8_t>(notifyView->execute(SCI_GETSTYLEAT, startPos - 1)) == style)
|
||||
while (startPos > 0 && static_cast<uint8_t>(notifyView->execute(SCI_GETSTYLEAT, static_cast<WPARAM>(startPos - 1))) == style)
|
||||
startPos--;
|
||||
while (endPos < docLen && static_cast<uint8_t>(notifyView->execute(SCI_GETSTYLEAT, endPos)) == style)
|
||||
while (endPos < docLen && static_cast<uint8_t>(notifyView->execute(SCI_GETSTYLEAT, static_cast<WPARAM>(endPos))) == style)
|
||||
endPos++;
|
||||
|
||||
// Select the entire link
|
||||
notifyView->execute(SCI_SETANCHOR, startPos);
|
||||
notifyView->execute(SCI_SETCURRENTPOS, endPos);
|
||||
notifyView->execute(SCI_SETANCHOR, static_cast<WPARAM>(startPos));
|
||||
notifyView->execute(SCI_SETCURRENTPOS, static_cast<WPARAM>(endPos));
|
||||
|
||||
generic_string url = notifyView->getGenericTextAsString(startPos, endPos);
|
||||
generic_string url = notifyView->getGenericTextAsString(static_cast<size_t>(startPos), static_cast<size_t>(endPos));
|
||||
|
||||
// remove the flickering: it seems a mouse left button up is missing after SCN_HOTSPOTDOUBLECLICK
|
||||
::PostMessage(notifyView->getHSelf(), WM_LBUTTONUP, 0, 0);
|
||||
|
@ -749,7 +749,7 @@ void AutoCompletion::update(int character)
|
||||
}
|
||||
}
|
||||
|
||||
void AutoCompletion::callTipClick(int direction) {
|
||||
void AutoCompletion::callTipClick(size_t direction) {
|
||||
if (!_funcCompletionActive)
|
||||
return;
|
||||
|
||||
|
@ -80,7 +80,7 @@ public:
|
||||
|
||||
void insertMatchedChars(int character, const MatchedPairConf & matchedPairConf);
|
||||
void update(int character);
|
||||
void callTipClick(int direction);
|
||||
void callTipClick(size_t direction);
|
||||
void getCloseTag(char *closeTag, size_t closeTagLen, size_t caretPos, bool isHTML);
|
||||
|
||||
private:
|
||||
|
@ -467,7 +467,7 @@ bool Finder::notify(SCNotification *notification)
|
||||
{
|
||||
// remove selection from the finder
|
||||
isDoubleClicked = true;
|
||||
int pos = notification->position;
|
||||
size_t pos = notification->position;
|
||||
if (pos == INVALID_POSITION)
|
||||
pos = static_cast<int32_t>(_scintView.execute(SCI_GETLINEENDPOSITION, notification->line));
|
||||
_scintView.execute(SCI_SETSEL, pos, pos);
|
||||
@ -905,7 +905,7 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
||||
{
|
||||
if (LOWORD(wParam) == WA_ACTIVE || LOWORD(wParam) == WA_CLICKACTIVE)
|
||||
{
|
||||
CharacterRange cr = (*_ppEditView)->getSelection();
|
||||
Sci_CharacterRange cr = (*_ppEditView)->getSelection();
|
||||
int nbSelected = cr.cpMax - cr.cpMin;
|
||||
|
||||
_options._isInSelection = isCheckedOrNot(IDC_IN_SELECTION_CHECK)?1:0;
|
||||
@ -1532,7 +1532,7 @@ bool FindReplaceDlg::processFindNext(const TCHAR *txt2find, const FindOption *op
|
||||
}
|
||||
|
||||
int docLength = int((*_ppEditView)->execute(SCI_GETLENGTH));
|
||||
CharacterRange cr = (*_ppEditView)->getSelection();
|
||||
Sci_CharacterRange cr = (*_ppEditView)->getSelection();
|
||||
|
||||
|
||||
//The search "zone" is relative to the selection, so search happens 'outside'
|
||||
@ -1817,7 +1817,7 @@ int FindReplaceDlg::processAll(ProcessOperation op, const FindOption *opt, bool
|
||||
const TCHAR *txt2find = pOptions->_str2Search.c_str();
|
||||
const TCHAR *txt2replace = pOptions->_str4Replace.c_str();
|
||||
|
||||
CharacterRange cr = (*_ppEditView)->getSelection();
|
||||
Sci_CharacterRange cr = (*_ppEditView)->getSelection();
|
||||
int docLength = int((*_ppEditView)->execute(SCI_GETLENGTH));
|
||||
|
||||
// Default :
|
||||
@ -3521,7 +3521,7 @@ INT_PTR CALLBACK FindIncrementDlg::run_dlgProc(UINT message, WPARAM wParam, LPAR
|
||||
// selected (no change, if there was no selection)
|
||||
if (updateCase && !isFound)
|
||||
{
|
||||
CharacterRange range = (*(_pFRDlg->_ppEditView))->getSelection();
|
||||
Sci_CharacterRange range = (*(_pFRDlg->_ppEditView))->getSelection();
|
||||
(*(_pFRDlg->_ppEditView))->execute(SCI_SETSEL, static_cast<WPARAM>(-1), range.cpMin);
|
||||
}
|
||||
}
|
||||
@ -3559,7 +3559,7 @@ void FindIncrementDlg::markSelectedTextInc(bool enable, FindOption *opt)
|
||||
return;
|
||||
|
||||
//Get selection
|
||||
CharacterRange range = (*(_pFRDlg->_ppEditView))->getSelection();
|
||||
Sci_CharacterRange range = (*(_pFRDlg->_ppEditView))->getSelection();
|
||||
|
||||
//If nothing selected, dont mark anything
|
||||
if (range.cpMin == range.cpMax)
|
||||
|
@ -39,7 +39,7 @@ struct NPP_RangeToFormat {
|
||||
HDC hdcTarget;
|
||||
RECT rc;
|
||||
RECT rcPage;
|
||||
CharacterRange chrg;
|
||||
Sci_CharacterRange chrg;
|
||||
};
|
||||
|
||||
class Printer
|
||||
|
@ -431,7 +431,7 @@ LRESULT ScintillaEditView::scintillaNew_Proc(HWND hwnd, UINT Message, WPARAM wPa
|
||||
|
||||
// get the current text selection
|
||||
|
||||
CharacterRange range = getSelection();
|
||||
Sci_CharacterRange range = getSelection();
|
||||
if (range.cpMax == range.cpMin)
|
||||
{
|
||||
// no selection: select the current word instead
|
||||
@ -1736,10 +1736,11 @@ void ScintillaEditView::defineDocType(LangType typeDoc)
|
||||
setSpecialStyle(styleLN);
|
||||
}
|
||||
setTabSettings(_pParameter->getLangFromID(typeDoc));
|
||||
|
||||
/*
|
||||
execute(SCI_SETSTYLEBITS, 8); // Always use 8 bit mask in Document class (Document::stylingBitsMask),
|
||||
// in that way Editor::PositionIsHotspot will return correct hotspot styleID.
|
||||
// This value has no effect on LexAccessor::mask.
|
||||
*/
|
||||
}
|
||||
|
||||
BufferID ScintillaEditView::attachDefaultDoc()
|
||||
@ -2024,7 +2025,7 @@ void ScintillaEditView::foldAll(bool mode)
|
||||
|
||||
void ScintillaEditView::getText(char *dest, size_t start, size_t end) const
|
||||
{
|
||||
TextRange tr;
|
||||
Sci_TextRange tr;
|
||||
tr.chrg.cpMin = static_cast<long>(start);
|
||||
tr.chrg.cpMax = static_cast<long>(end);
|
||||
tr.lpstrText = dest;
|
||||
@ -2138,7 +2139,7 @@ char * ScintillaEditView::getSelectedText(char * txt, int size, bool expand)
|
||||
{
|
||||
if (!size)
|
||||
return NULL;
|
||||
CharacterRange range = getSelection();
|
||||
Sci_CharacterRange range = getSelection();
|
||||
if (range.cpMax == range.cpMin && expand)
|
||||
{
|
||||
expandWordSelection();
|
||||
@ -2282,27 +2283,27 @@ void ScintillaEditView::beginOrEndSelect()
|
||||
}
|
||||
else
|
||||
{
|
||||
execute(SCI_SETANCHOR, _beginSelectPosition);
|
||||
execute(SCI_SETANCHOR, static_cast<WPARAM>(_beginSelectPosition));
|
||||
_beginSelectPosition = -1;
|
||||
}
|
||||
}
|
||||
|
||||
void ScintillaEditView::updateBeginEndSelectPosition(const bool is_insert, const int position, const int length)
|
||||
void ScintillaEditView::updateBeginEndSelectPosition(bool is_insert, size_t position, size_t length)
|
||||
{
|
||||
if (_beginSelectPosition != -1 && position < _beginSelectPosition - 1)
|
||||
if (_beginSelectPosition != -1 && static_cast<long long>(position) < _beginSelectPosition - 1)
|
||||
{
|
||||
if (is_insert)
|
||||
_beginSelectPosition += length;
|
||||
_beginSelectPosition += static_cast<long long>(length);
|
||||
else
|
||||
_beginSelectPosition -= length;
|
||||
_beginSelectPosition -= static_cast<long long>(length);
|
||||
|
||||
assert(_beginSelectPosition >= 0);
|
||||
}
|
||||
}
|
||||
|
||||
void ScintillaEditView::marginClick(int position, int modifiers)
|
||||
void ScintillaEditView::marginClick(Sci_Position position, int modifiers)
|
||||
{
|
||||
int lineClick = int(execute(SCI_LINEFROMPOSITION, position, 0));
|
||||
size_t lineClick = execute(SCI_LINEFROMPOSITION, position, 0);
|
||||
int levelClick = int(execute(SCI_GETFOLDLEVEL, lineClick, 0));
|
||||
if (levelClick & SC_FOLDLEVELHEADERFLAG)
|
||||
{
|
||||
@ -2337,9 +2338,9 @@ void ScintillaEditView::marginClick(int position, int modifiers)
|
||||
}
|
||||
}
|
||||
|
||||
void ScintillaEditView::expand(int &line, bool doExpand, bool force, int visLevels, int level)
|
||||
void ScintillaEditView::expand(size_t& line, bool doExpand, bool force, int visLevels, int level)
|
||||
{
|
||||
int lineMaxSubord = int(execute(SCI_GETLASTCHILD, line, level & SC_FOLDLEVELNUMBERMASK));
|
||||
size_t lineMaxSubord = execute(SCI_GETLASTCHILD, line, level & SC_FOLDLEVELNUMBERMASK);
|
||||
++line;
|
||||
while (line <= lineMaxSubord)
|
||||
{
|
||||
@ -2461,7 +2462,7 @@ void ScintillaEditView::performGlobalStyles()
|
||||
void ScintillaEditView::setLineIndent(int line, int indent) const {
|
||||
if (indent < 0)
|
||||
return;
|
||||
CharacterRange crange = getSelection();
|
||||
Sci_CharacterRange crange = getSelection();
|
||||
int posBefore = static_cast<int32_t>(execute(SCI_GETLINEINDENTPOSITION, line));
|
||||
execute(SCI_SETLINEINDENTATION, line, indent);
|
||||
int32_t posAfter = static_cast<int32_t>(execute(SCI_GETLINEINDENTPOSITION, line));
|
||||
@ -3050,7 +3051,7 @@ void ScintillaEditView::columnReplace(ColumnModeInfos & cmi, int initial, int in
|
||||
}
|
||||
|
||||
|
||||
void ScintillaEditView::foldChanged(int line, int levelNow, int levelPrev)
|
||||
void ScintillaEditView::foldChanged(size_t line, int levelNow, int levelPrev)
|
||||
{
|
||||
if (levelNow & SC_FOLDLEVELHEADERFLAG) //line can be folded
|
||||
{
|
||||
@ -3196,7 +3197,7 @@ void ScintillaEditView::notifyMarkers(Buffer * buf, bool isHide, int location, b
|
||||
}
|
||||
//Run through full document. When switching in or opening folding
|
||||
//hide is false only when user click on margin
|
||||
void ScintillaEditView::runMarkers(bool doHide, int searchStart, bool endOfDoc, bool doDelete)
|
||||
void ScintillaEditView::runMarkers(bool doHide, size_t searchStart, bool endOfDoc, bool doDelete)
|
||||
{
|
||||
//Removes markers if opening
|
||||
/*
|
||||
@ -3224,12 +3225,12 @@ void ScintillaEditView::runMarkers(bool doHide, int searchStart, bool endOfDoc,
|
||||
Skip to LASTCHILD
|
||||
Set last start to lastchild
|
||||
*/
|
||||
int maxLines = static_cast<int32_t>(execute(SCI_GETLINECOUNT));
|
||||
size_t maxLines = execute(SCI_GETLINECOUNT);
|
||||
if (doHide)
|
||||
{
|
||||
int startHiding = searchStart;
|
||||
auto startHiding = searchStart;
|
||||
bool isInSection = false;
|
||||
for (int i = searchStart; i < maxLines; ++i)
|
||||
for (auto i = searchStart; i < maxLines; ++i)
|
||||
{
|
||||
auto state = execute(SCI_MARKERGET, i);
|
||||
if ( ((state & (1 << MARK_HIDELINESEND)) != 0) )
|
||||
@ -3254,9 +3255,9 @@ void ScintillaEditView::runMarkers(bool doHide, int searchStart, bool endOfDoc,
|
||||
}
|
||||
else
|
||||
{
|
||||
int startShowing = searchStart;
|
||||
auto startShowing = searchStart;
|
||||
bool isInSection = false;
|
||||
for (int i = searchStart; i < maxLines; ++i)
|
||||
for (auto i = searchStart; i < maxLines; ++i)
|
||||
{
|
||||
auto state = execute(SCI_MARKERGET, i);
|
||||
if ( ((state & (1 << MARK_HIDELINESEND)) != 0) )
|
||||
|
@ -244,7 +244,7 @@ public:
|
||||
void replaceSelWith(const char * replaceText);
|
||||
|
||||
int getSelectedTextCount() {
|
||||
CharacterRange range = getSelection();
|
||||
Sci_CharacterRange range = getSelection();
|
||||
return (range.cpMax - range.cpMin);
|
||||
};
|
||||
|
||||
@ -281,8 +281,8 @@ public:
|
||||
return int(execute(SCI_GETLENGTH));
|
||||
};
|
||||
|
||||
CharacterRange getSelection() const {
|
||||
CharacterRange crange;
|
||||
Sci_CharacterRange getSelection() const {
|
||||
Sci_CharacterRange crange;
|
||||
crange.cpMin = long(execute(SCI_GETSELECTIONSTART));
|
||||
crange.cpMax = long(execute(SCI_GETSELECTIONEND));
|
||||
return crange;
|
||||
@ -336,8 +336,8 @@ public:
|
||||
return (execute(SCI_GETMARGINWIDTHN, witchMarge, 0) != 0);
|
||||
};
|
||||
|
||||
void updateBeginEndSelectPosition(const bool is_insert, const int position, const int length);
|
||||
void marginClick(int position, int modifiers);
|
||||
void updateBeginEndSelectPosition(bool is_insert, size_t position, size_t length);
|
||||
void marginClick(Sci_Position position, int modifiers);
|
||||
|
||||
void setMakerStyle(folderStyle style) {
|
||||
bool display;
|
||||
@ -532,7 +532,7 @@ public:
|
||||
|
||||
void performGlobalStyles();
|
||||
|
||||
void expand(int &line, bool doExpand, bool force = false, int visLevels = 0, int level = -1);
|
||||
void expand(size_t& line, bool doExpand, bool force = false, int visLevels = 0, int level = -1);
|
||||
|
||||
std::pair<int, int> getSelectionLinesRange() const;
|
||||
void currentLinesUp() const;
|
||||
@ -569,7 +569,7 @@ public:
|
||||
void collapse(int level2Collapse, bool mode);
|
||||
void foldAll(bool mode);
|
||||
void fold(size_t line, bool mode);
|
||||
bool isFolded(int line){
|
||||
bool isFolded(size_t line) {
|
||||
return (execute(SCI_GETFOLDEXPANDED, line) != 0);
|
||||
};
|
||||
void foldCurrentPos(bool mode);
|
||||
@ -584,7 +584,7 @@ public:
|
||||
void columnReplace(ColumnModeInfos & cmi, const TCHAR *str);
|
||||
void columnReplace(ColumnModeInfos & cmi, int initial, int incr, int repeat, UCHAR format);
|
||||
|
||||
void foldChanged(int line, int levelNow, int levelPrev);
|
||||
void foldChanged(size_t line, int levelNow, int levelPrev);
|
||||
void clearIndicator(int indicatorNumber) {
|
||||
int docStart = 0;
|
||||
int docEnd = getCurrentDocLen();
|
||||
@ -604,11 +604,11 @@ public:
|
||||
|
||||
bool markerMarginClick(int lineNumber); //true if it did something
|
||||
void notifyMarkers(Buffer * buf, bool isHide, int location, bool del);
|
||||
void runMarkers(bool doHide, int searchStart, bool endOfDoc, bool doDelete);
|
||||
void runMarkers(bool doHide, size_t searchStart, bool endOfDoc, bool doDelete);
|
||||
|
||||
bool isSelecting() const {
|
||||
static CharacterRange previousSelRange = getSelection();
|
||||
CharacterRange currentSelRange = getSelection();
|
||||
static Sci_CharacterRange previousSelRange = getSelection();
|
||||
Sci_CharacterRange currentSelRange = getSelection();
|
||||
|
||||
if (currentSelRange.cpMin == currentSelRange.cpMax)
|
||||
{
|
||||
@ -682,7 +682,7 @@ protected:
|
||||
typedef std::unordered_map<BufferID, StyleMap*> BufferStyleMap;
|
||||
BufferStyleMap _hotspotStyles;
|
||||
|
||||
int _beginSelectPosition = -1;
|
||||
long long _beginSelectPosition = -1;
|
||||
|
||||
static std::string _defaultCharList;
|
||||
|
||||
|
@ -332,7 +332,7 @@ void DocumentMap::doMove()
|
||||
::MoveWindow(_vzDlg.getHSelf(), pt.x, pt.y, (rc.right - rc.left), (rc.bottom - rc.top), TRUE);
|
||||
}
|
||||
|
||||
void DocumentMap::fold(int line, bool foldOrNot)
|
||||
void DocumentMap::fold(size_t line, bool foldOrNot)
|
||||
{
|
||||
_pMapView->fold(line, foldOrNot);
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ public:
|
||||
void scrollMap(bool direction, moveMode whichMode);
|
||||
void scrollMapWith(const MapPosition & mapPos);
|
||||
void doMove();
|
||||
void fold(int line, bool foldOrNot);
|
||||
void fold(size_t line, bool foldOrNot);
|
||||
void foldAll(bool mode);
|
||||
void setSyntaxHiliting();
|
||||
void changeTextDirection(bool isRTL);
|
||||
|
Loading…
Reference in New Issue
Block a user