Use SCI_SETTARGETRANGE where possible
This commit is contained in:
parent
7d76a18ec8
commit
24c11375cf
@ -978,8 +978,7 @@ int Notepad_plus::getHtmlXmlEncoding(const TCHAR *fileName) const
|
|||||||
int endPos = lenFile-1;
|
int endPos = lenFile-1;
|
||||||
_invisibleEditView.execute(SCI_SETSEARCHFLAGS, SCFIND_REGEXP|SCFIND_POSIX);
|
_invisibleEditView.execute(SCI_SETSEARCHFLAGS, SCFIND_REGEXP|SCFIND_POSIX);
|
||||||
|
|
||||||
_invisibleEditView.execute(SCI_SETTARGETSTART, startPos);
|
_invisibleEditView.execute(SCI_SETTARGETRANGE, startPos, endPos);
|
||||||
_invisibleEditView.execute(SCI_SETTARGETEND, endPos);
|
|
||||||
|
|
||||||
int posFound = _invisibleEditView.execute(SCI_SEARCHINTARGET, strlen(xmlHeaderRegExpr), (LPARAM)xmlHeaderRegExpr);
|
int posFound = _invisibleEditView.execute(SCI_SEARCHINTARGET, strlen(xmlHeaderRegExpr), (LPARAM)xmlHeaderRegExpr);
|
||||||
if (posFound != -1 && posFound != -2)
|
if (posFound != -1 && posFound != -2)
|
||||||
@ -1016,8 +1015,7 @@ int Notepad_plus::getHtmlXmlEncoding(const TCHAR *fileName) const
|
|||||||
int endPos = lenFile-1;
|
int endPos = lenFile-1;
|
||||||
_invisibleEditView.execute(SCI_SETSEARCHFLAGS, SCFIND_REGEXP|SCFIND_POSIX);
|
_invisibleEditView.execute(SCI_SETSEARCHFLAGS, SCFIND_REGEXP|SCFIND_POSIX);
|
||||||
|
|
||||||
_invisibleEditView.execute(SCI_SETTARGETSTART, startPos);
|
_invisibleEditView.execute(SCI_SETTARGETRANGE, startPos, endPos);
|
||||||
_invisibleEditView.execute(SCI_SETTARGETEND, endPos);
|
|
||||||
|
|
||||||
int posFound = _invisibleEditView.execute(SCI_SEARCHINTARGET, strlen(htmlHeaderRegExpr), (LPARAM)htmlHeaderRegExpr);
|
int posFound = _invisibleEditView.execute(SCI_SEARCHINTARGET, strlen(htmlHeaderRegExpr), (LPARAM)htmlHeaderRegExpr);
|
||||||
|
|
||||||
@ -2207,8 +2205,7 @@ void Notepad_plus::addHotSpot()
|
|||||||
|
|
||||||
_pEditView->execute(SCI_SETSEARCHFLAGS, SCFIND_REGEXP|SCFIND_POSIX);
|
_pEditView->execute(SCI_SETSEARCHFLAGS, SCFIND_REGEXP|SCFIND_POSIX);
|
||||||
|
|
||||||
_pEditView->execute(SCI_SETTARGETSTART, startPos);
|
_pEditView->execute(SCI_SETTARGETRANGE, startPos, endPos);
|
||||||
_pEditView->execute(SCI_SETTARGETEND, endPos);
|
|
||||||
|
|
||||||
std::vector<unsigned char> hotspotPairs; //= _pEditView->GetHotspotPairs();
|
std::vector<unsigned char> hotspotPairs; //= _pEditView->GetHotspotPairs();
|
||||||
|
|
||||||
@ -2307,8 +2304,7 @@ void Notepad_plus::addHotSpot()
|
|||||||
_pEditView->execute(SCI_SETSTYLING, foundTextLen, style_hotspot);
|
_pEditView->execute(SCI_SETSTYLING, foundTextLen, style_hotspot);
|
||||||
}
|
}
|
||||||
|
|
||||||
_pEditView->execute(SCI_SETTARGETSTART, posFound + foundTextLen);
|
_pEditView->execute(SCI_SETTARGETRANGE, posFound + foundTextLen, endPos);
|
||||||
_pEditView->execute(SCI_SETTARGETEND, endPos);
|
|
||||||
|
|
||||||
posFound = _pEditView->execute(SCI_SEARCHINTARGET, strlen(URL_REG_EXPR), (LPARAM)URL_REG_EXPR);
|
posFound = _pEditView->execute(SCI_SEARCHINTARGET, strlen(URL_REG_EXPR), (LPARAM)URL_REG_EXPR);
|
||||||
}
|
}
|
||||||
@ -2325,8 +2321,7 @@ bool Notepad_plus::isConditionExprLine(int lineNumber)
|
|||||||
int startPos = _pEditView->execute(SCI_POSITIONFROMLINE, lineNumber);
|
int startPos = _pEditView->execute(SCI_POSITIONFROMLINE, lineNumber);
|
||||||
int endPos = _pEditView->execute(SCI_GETLINEENDPOSITION, lineNumber);
|
int endPos = _pEditView->execute(SCI_GETLINEENDPOSITION, lineNumber);
|
||||||
_pEditView->execute(SCI_SETSEARCHFLAGS, SCFIND_REGEXP | SCFIND_POSIX);
|
_pEditView->execute(SCI_SETSEARCHFLAGS, SCFIND_REGEXP | SCFIND_POSIX);
|
||||||
_pEditView->execute(SCI_SETTARGETSTART, startPos);
|
_pEditView->execute(SCI_SETTARGETRANGE, startPos, endPos);
|
||||||
_pEditView->execute(SCI_SETTARGETEND, endPos);
|
|
||||||
|
|
||||||
const char ifElseForWhileExpr[] = "((else[ \t]+)?if|for|while)[ \t]*[(].*[)][ \t]*|else[ \t]*";
|
const char ifElseForWhileExpr[] = "((else[ \t]+)?if|for|while)[ \t]*[(].*[)][ \t]*|else[ \t]*";
|
||||||
|
|
||||||
@ -2464,8 +2459,7 @@ void Notepad_plus::maintainIndentation(TCHAR ch)
|
|||||||
int startPos = _pEditView->execute(SCI_POSITIONFROMLINE, prevLine);
|
int startPos = _pEditView->execute(SCI_POSITIONFROMLINE, prevLine);
|
||||||
int endPos = _pEditView->execute(SCI_GETLINEENDPOSITION, prevLine);
|
int endPos = _pEditView->execute(SCI_GETLINEENDPOSITION, prevLine);
|
||||||
_pEditView->execute(SCI_SETSEARCHFLAGS, SCFIND_REGEXP | SCFIND_POSIX);
|
_pEditView->execute(SCI_SETSEARCHFLAGS, SCFIND_REGEXP | SCFIND_POSIX);
|
||||||
_pEditView->execute(SCI_SETTARGETSTART, startPos);
|
_pEditView->execute(SCI_SETTARGETRANGE, startPos, endPos);
|
||||||
_pEditView->execute(SCI_SETTARGETEND, endPos);
|
|
||||||
|
|
||||||
const char braceExpr[] = "[ \t]*\\{.*";
|
const char braceExpr[] = "[ \t]*\\{.*";
|
||||||
|
|
||||||
|
@ -1216,8 +1216,7 @@ void Notepad_plus::command(int id)
|
|||||||
|
|
||||||
case IDM_EDIT_EOL2WS:
|
case IDM_EDIT_EOL2WS:
|
||||||
_pEditView->execute(SCI_BEGINUNDOACTION);
|
_pEditView->execute(SCI_BEGINUNDOACTION);
|
||||||
_pEditView->execute(SCI_SETTARGETSTART, 0);
|
_pEditView->execute(SCI_SETTARGETRANGE, 0, _pEditView->getCurrentDocLen());
|
||||||
_pEditView->execute(SCI_SETTARGETEND, _pEditView->getCurrentDocLen());
|
|
||||||
_pEditView->execute(SCI_LINESJOIN);
|
_pEditView->execute(SCI_LINESJOIN);
|
||||||
_pEditView->execute(SCI_ENDUNDOACTION);
|
_pEditView->execute(SCI_ENDUNDOACTION);
|
||||||
break;
|
break;
|
||||||
@ -1226,8 +1225,7 @@ void Notepad_plus::command(int id)
|
|||||||
_pEditView->execute(SCI_BEGINUNDOACTION);
|
_pEditView->execute(SCI_BEGINUNDOACTION);
|
||||||
doTrim(lineTail);
|
doTrim(lineTail);
|
||||||
doTrim(lineHeader);
|
doTrim(lineHeader);
|
||||||
_pEditView->execute(SCI_SETTARGETSTART, 0);
|
_pEditView->execute(SCI_SETTARGETRANGE, 0, _pEditView->getCurrentDocLen());
|
||||||
_pEditView->execute(SCI_SETTARGETEND, _pEditView->getCurrentDocLen());
|
|
||||||
_pEditView->execute(SCI_LINESJOIN);
|
_pEditView->execute(SCI_LINESJOIN);
|
||||||
_pEditView->execute(SCI_ENDUNDOACTION);
|
_pEditView->execute(SCI_ENDUNDOACTION);
|
||||||
break;
|
break;
|
||||||
|
@ -853,8 +853,7 @@ BOOL Notepad_plus::notify(SCNotification *notification)
|
|||||||
int startPos = static_cast<int>(notifyView->execute(SCI_WORDSTARTPOSITION, pos, false));
|
int startPos = static_cast<int>(notifyView->execute(SCI_WORDSTARTPOSITION, pos, false));
|
||||||
int endPos = static_cast<int>(notifyView->execute(SCI_WORDENDPOSITION, pos, false));
|
int endPos = static_cast<int>(notifyView->execute(SCI_WORDENDPOSITION, pos, false));
|
||||||
|
|
||||||
notifyView->execute(SCI_SETTARGETSTART, startPos);
|
notifyView->execute(SCI_SETTARGETRANGE, startPos, endPos);
|
||||||
notifyView->execute(SCI_SETTARGETEND, endPos);
|
|
||||||
|
|
||||||
int posFound = notifyView->execute(SCI_SEARCHINTARGET, strlen(URL_REG_EXPR), (LPARAM)URL_REG_EXPR);
|
int posFound = notifyView->execute(SCI_SEARCHINTARGET, strlen(URL_REG_EXPR), (LPARAM)URL_REG_EXPR);
|
||||||
if (posFound != -2)
|
if (posFound != -2)
|
||||||
|
@ -1952,8 +1952,7 @@ TCHAR * ScintillaEditView::getGenericSelectedText(TCHAR * txt, int size, bool ex
|
|||||||
|
|
||||||
int ScintillaEditView::searchInTarget(const TCHAR * text2Find, int lenOfText2Find, int fromPos, int toPos) const
|
int ScintillaEditView::searchInTarget(const TCHAR * text2Find, int lenOfText2Find, int fromPos, int toPos) const
|
||||||
{
|
{
|
||||||
execute(SCI_SETTARGETSTART, fromPos);
|
execute(SCI_SETTARGETRANGE, fromPos, toPos);
|
||||||
execute(SCI_SETTARGETEND, toPos);
|
|
||||||
|
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
||||||
unsigned int cp = execute(SCI_GETCODEPAGE);
|
unsigned int cp = execute(SCI_GETCODEPAGE);
|
||||||
@ -1992,8 +1991,7 @@ int ScintillaEditView::replaceTarget(const TCHAR * str2replace, int fromTargetPo
|
|||||||
{
|
{
|
||||||
if (fromTargetPos != -1 || toTargetPos != -1)
|
if (fromTargetPos != -1 || toTargetPos != -1)
|
||||||
{
|
{
|
||||||
execute(SCI_SETTARGETSTART, fromTargetPos);
|
execute(SCI_SETTARGETRANGE, fromTargetPos, toTargetPos);
|
||||||
execute(SCI_SETTARGETEND, toTargetPos);
|
|
||||||
}
|
}
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
||||||
unsigned int cp = execute(SCI_GETCODEPAGE);
|
unsigned int cp = execute(SCI_GETCODEPAGE);
|
||||||
@ -2005,8 +2003,7 @@ int ScintillaEditView::replaceTargetRegExMode(const TCHAR * re, int fromTargetPo
|
|||||||
{
|
{
|
||||||
if (fromTargetPos != -1 || toTargetPos != -1)
|
if (fromTargetPos != -1 || toTargetPos != -1)
|
||||||
{
|
{
|
||||||
execute(SCI_SETTARGETSTART, fromTargetPos);
|
execute(SCI_SETTARGETRANGE, fromTargetPos, toTargetPos);
|
||||||
execute(SCI_SETTARGETEND, toTargetPos);
|
|
||||||
}
|
}
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
||||||
unsigned int cp = execute(SCI_GETCODEPAGE);
|
unsigned int cp = execute(SCI_GETCODEPAGE);
|
||||||
@ -2427,8 +2424,7 @@ void ScintillaEditView::convertSelectedTextTo(bool Case)
|
|||||||
}
|
}
|
||||||
::WideCharToMultiByte(codepage, 0, destStr, len, srcStr, len, NULL, NULL);
|
::WideCharToMultiByte(codepage, 0, destStr, len, srcStr, len, NULL, NULL);
|
||||||
|
|
||||||
execute(SCI_SETTARGETSTART, start);
|
execute(SCI_SETTARGETRANGE, start, end);
|
||||||
execute(SCI_SETTARGETEND, end);
|
|
||||||
execute(SCI_REPLACETARGET, (WPARAM)-1, (LPARAM)srcStr);
|
execute(SCI_REPLACETARGET, (WPARAM)-1, (LPARAM)srcStr);
|
||||||
|
|
||||||
delete [] srcStr;
|
delete [] srcStr;
|
||||||
@ -2467,8 +2463,7 @@ void ScintillaEditView::convertSelectedTextTo(bool Case)
|
|||||||
}
|
}
|
||||||
::WideCharToMultiByte(codepage, 0, selectedStrW, strWSize, selectedStr, strSize, NULL, NULL);
|
::WideCharToMultiByte(codepage, 0, selectedStrW, strWSize, selectedStr, strSize, NULL, NULL);
|
||||||
|
|
||||||
execute(SCI_SETTARGETSTART, selectionStart);
|
execute(SCI_SETTARGETRANGE, selectionStart, selectionEnd);
|
||||||
execute(SCI_SETTARGETEND, selectionEnd);
|
|
||||||
execute(SCI_REPLACETARGET, strSize - 1, (LPARAM)selectedStr);
|
execute(SCI_REPLACETARGET, strSize - 1, (LPARAM)selectedStr);
|
||||||
execute(SCI_SETSEL, selectionStart, selectionEnd);
|
execute(SCI_SETSEL, selectionStart, selectionEnd);
|
||||||
delete [] selectedStr;
|
delete [] selectedStr;
|
||||||
@ -2609,8 +2604,7 @@ void ScintillaEditView::columnReplace(ColumnModeInfos & cmi, const TCHAR *str)
|
|||||||
cmi[i]._selRpos += cmi[i]._nbVirtualCaretSpc;
|
cmi[i]._selRpos += cmi[i]._nbVirtualCaretSpc;
|
||||||
}
|
}
|
||||||
|
|
||||||
execute(SCI_SETTARGETSTART, cmi[i]._selLpos);
|
execute(SCI_SETTARGETRANGE, cmi[i]._selLpos, cmi[i]._selRpos);
|
||||||
execute(SCI_SETTARGETEND, cmi[i]._selRpos);
|
|
||||||
|
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
||||||
unsigned int cp = execute(SCI_GETCODEPAGE);
|
unsigned int cp = execute(SCI_GETCODEPAGE);
|
||||||
@ -2712,8 +2706,7 @@ void ScintillaEditView::columnReplace(ColumnModeInfos & cmi, int initial, int in
|
|||||||
cmi[i]._selLpos += cmi[i]._nbVirtualAnchorSpc;
|
cmi[i]._selLpos += cmi[i]._nbVirtualAnchorSpc;
|
||||||
cmi[i]._selRpos += cmi[i]._nbVirtualCaretSpc;
|
cmi[i]._selRpos += cmi[i]._nbVirtualCaretSpc;
|
||||||
}
|
}
|
||||||
execute(SCI_SETTARGETSTART, cmi[i]._selLpos);
|
execute(SCI_SETTARGETRANGE, cmi[i]._selLpos, cmi[i]._selRpos);
|
||||||
execute(SCI_SETTARGETEND, cmi[i]._selRpos);
|
|
||||||
|
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
||||||
unsigned int cp = execute(SCI_GETCODEPAGE);
|
unsigned int cp = execute(SCI_GETCODEPAGE);
|
||||||
|
@ -132,8 +132,7 @@ void SmartHighlighter::highlightView(ScintillaEditView * pHighlightView)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// restore the original targets to avoid conflicts with the search/replace functions
|
// restore the original targets to avoid conflicts with the search/replace functions
|
||||||
pHighlightView->execute(SCI_SETTARGETSTART, originalStartPos);
|
pHighlightView->execute(SCI_SETTARGETRANGE, originalStartPos, originalEndPos);
|
||||||
pHighlightView->execute(SCI_SETTARGETEND, originalEndPos);
|
|
||||||
delete [] listChar;
|
delete [] listChar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -665,7 +665,6 @@ void XmlMatchedTagsHighlighter::tagMatch(bool doHiliteAttr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// restore the original targets and search options to avoid the conflit with search/replace function
|
// restore the original targets and search options to avoid the conflit with search/replace function
|
||||||
_pEditView->execute(SCI_SETTARGETSTART, originalStartPos);
|
_pEditView->execute(SCI_SETTARGETRANGE, originalStartPos, originalEndPos);
|
||||||
_pEditView->execute(SCI_SETTARGETEND, originalEndPos);
|
|
||||||
_pEditView->execute(SCI_SETSEARCHFLAGS, originalSearchFlags);
|
_pEditView->execute(SCI_SETSEARCHFLAGS, originalSearchFlags);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user