|
|
@ -1150,12 +1150,14 @@ int FindReplaceDlg::processRange(ProcessOperation op, const char *txt2find, cons
|
|
|
|
return -1;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
switch (op) {
|
|
|
|
switch (op)
|
|
|
|
case ProcessFindAll: {
|
|
|
|
{
|
|
|
|
|
|
|
|
case ProcessFindAll:
|
|
|
|
|
|
|
|
{
|
|
|
|
int lineNumber = (*_ppEditView)->execute(SCI_LINEFROMPOSITION, targetStart);
|
|
|
|
int lineNumber = (*_ppEditView)->execute(SCI_LINEFROMPOSITION, targetStart);
|
|
|
|
int lend = (*_ppEditView)->execute(SCI_GETLINEENDPOSITION, lineNumber);
|
|
|
|
//int lend = (*_ppEditView)->execute(SCI_GETLINEENDPOSITION, lineNumber);
|
|
|
|
int lstart = (*_ppEditView)->execute(SCI_POSITIONFROMLINE, lineNumber);
|
|
|
|
//int lstart = (*_ppEditView)->execute(SCI_POSITIONFROMLINE, lineNumber);
|
|
|
|
int nbChar = lend - lstart;
|
|
|
|
int nbChar = (*_ppEditView)->execute(SCI_LINELENGTH, lineNumber);
|
|
|
|
bool isRealloc = false;
|
|
|
|
bool isRealloc = false;
|
|
|
|
|
|
|
|
|
|
|
|
if (_maxNbCharAllocated < nbChar) //line longer than buffer, resize buffer
|
|
|
|
if (_maxNbCharAllocated < nbChar) //line longer than buffer, resize buffer
|
|
|
@ -1164,15 +1166,13 @@ int FindReplaceDlg::processRange(ProcessOperation op, const char *txt2find, cons
|
|
|
|
_maxNbCharAllocated = nbChar;
|
|
|
|
_maxNbCharAllocated = nbChar;
|
|
|
|
delete [] _line;
|
|
|
|
delete [] _line;
|
|
|
|
_line = new char[_maxNbCharAllocated + 3];
|
|
|
|
_line = new char[_maxNbCharAllocated + 3];
|
|
|
|
if (isUnicode) //if unicode, also resize unicode buffer
|
|
|
|
|
|
|
|
{
|
|
|
|
// also resize unicode buffer
|
|
|
|
const int uniCharLen = (_maxNbCharAllocated + 3) * 2 + 1;
|
|
|
|
const int uniCharLen = (_maxNbCharAllocated + 3) * 2 + 1;
|
|
|
|
delete [] _uniCharLine;
|
|
|
|
delete [] _uniCharLine;
|
|
|
|
_uniCharLine = new char[uniCharLen];
|
|
|
|
_uniCharLine = new char[uniCharLen];
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
(*_ppEditView)->execute(SCI_GETLINE, lineNumber, (LPARAM)_line);
|
|
|
|
(*_ppEditView)->execute(SCI_GETLINE, lineNumber, (LPARAM)_line);
|
|
|
|
|
|
|
|
|
|
|
|
_line[nbChar] = 0x0D;
|
|
|
|
_line[nbChar] = 0x0D;
|
|
|
|
_line[nbChar+1] = 0x0A;
|
|
|
|
_line[nbChar+1] = 0x0A;
|
|
|
|
_line[nbChar+2] = '\0';
|
|
|
|
_line[nbChar+2] = '\0';
|
|
|
@ -1187,16 +1187,20 @@ int FindReplaceDlg::processRange(ProcessOperation op, const char *txt2find, cons
|
|
|
|
{
|
|
|
|
{
|
|
|
|
pLine = _line;
|
|
|
|
pLine = _line;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//printStr(isUnicode?"unicode":"no unicode");
|
|
|
|
|
|
|
|
_pFinder->add(FoundInfo(targetStart, targetEnd, pLine, fileName, _pFinder->_lineCounter), lineNumber + 1);
|
|
|
|
_pFinder->add(FoundInfo(targetStart, targetEnd, pLine, fileName, _pFinder->_lineCounter), lineNumber + 1);
|
|
|
|
break; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case ProcessReplaceAll: {
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case ProcessReplaceAll:
|
|
|
|
|
|
|
|
{
|
|
|
|
int replacedLength = (*_ppEditView)->execute(isRegExp?SCI_REPLACETARGETRE:SCI_REPLACETARGET, (WPARAM)stringSizeReplace, (LPARAM)pTextReplace);
|
|
|
|
int replacedLength = (*_ppEditView)->execute(isRegExp?SCI_REPLACETARGETRE:SCI_REPLACETARGET, (WPARAM)stringSizeReplace, (LPARAM)pTextReplace);
|
|
|
|
replaceDelta = replacedLength - foundTextLen;
|
|
|
|
replaceDelta = replacedLength - foundTextLen;
|
|
|
|
break; }
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
case ProcessMarkAll: {
|
|
|
|
case ProcessMarkAll:
|
|
|
|
|
|
|
|
{
|
|
|
|
if (_doStyleFoundToken)
|
|
|
|
if (_doStyleFoundToken)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
(*_ppEditView)->execute(SCI_SETINDICATORCURRENT, SCE_UNIVERSAL_FOUND_STYLE);
|
|
|
|
(*_ppEditView)->execute(SCI_SETINDICATORCURRENT, SCE_UNIVERSAL_FOUND_STYLE);
|
|
|
@ -1211,23 +1215,31 @@ int FindReplaceDlg::processRange(ProcessOperation op, const char *txt2find, cons
|
|
|
|
if (!(state & (1 << MARK_BOOKMARK)))
|
|
|
|
if (!(state & (1 << MARK_BOOKMARK)))
|
|
|
|
(*_ppEditView)->execute(SCI_MARKERADD, lineNumber, MARK_BOOKMARK);
|
|
|
|
(*_ppEditView)->execute(SCI_MARKERADD, lineNumber, MARK_BOOKMARK);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break; }
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
case ProcessMarkAll_2: {
|
|
|
|
case ProcessMarkAll_2:
|
|
|
|
|
|
|
|
{
|
|
|
|
(*_ppEditView)->execute(SCI_SETINDICATORCURRENT, SCE_UNIVERSAL_FOUND_STYLE_2);
|
|
|
|
(*_ppEditView)->execute(SCI_SETINDICATORCURRENT, SCE_UNIVERSAL_FOUND_STYLE_2);
|
|
|
|
(*_ppEditView)->execute(SCI_INDICATORFILLRANGE, targetStart, foundTextLen);
|
|
|
|
(*_ppEditView)->execute(SCI_INDICATORFILLRANGE, targetStart, foundTextLen);
|
|
|
|
break; }
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
case ProcessMarkAll_IncSearch: {
|
|
|
|
case ProcessMarkAll_IncSearch:
|
|
|
|
|
|
|
|
{
|
|
|
|
(*_ppEditView)->execute(SCI_SETINDICATORCURRENT, SCE_UNIVERSAL_FOUND_STYLE_INC);
|
|
|
|
(*_ppEditView)->execute(SCI_SETINDICATORCURRENT, SCE_UNIVERSAL_FOUND_STYLE_INC);
|
|
|
|
(*_ppEditView)->execute(SCI_INDICATORFILLRANGE, targetStart, foundTextLen);
|
|
|
|
(*_ppEditView)->execute(SCI_INDICATORFILLRANGE, targetStart, foundTextLen);
|
|
|
|
break; }
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
case ProcessCountAll: {
|
|
|
|
case ProcessCountAll:
|
|
|
|
|
|
|
|
{
|
|
|
|
//Nothing to do
|
|
|
|
//Nothing to do
|
|
|
|
break; }
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
default: {
|
|
|
|
default:
|
|
|
|
|
|
|
|
{
|
|
|
|
delete [] pTextFind;
|
|
|
|
delete [] pTextFind;
|
|
|
|
delete [] pTextReplace;
|
|
|
|
delete [] pTextReplace;
|
|
|
|
return nbProcessed;
|
|
|
|
return nbProcessed;
|
|
|
|