#79 Solution for Bug 1874851

Next_major_release
closed
nobody
None
5
2014-08-17
2008-07-29
CarlosCastaneda
No

I think I've got a fix when using regexp of the form "^[^(]*$". The problem is, that npp searches and never moves beyond the document's end. Hence my suggestion is to modify FindReplaceDlg.cpp at the following lines:

852:

if (posFind == -1) //no match found in target, check if a new target should be used

could be replaced by the following line to stop at document's end (should work). Especially if all the variables are equal:
startPosition==endPosition==posFind==documentLength
if (posFind == -1 || (startPosition==posFind)) //no match found in target, check if a new target should be used

1122:
while (posFind != -1)
should be extended with a similar condition as in line 852

1130
// Search resulted in empty token, problematic (can this happen?)!!!
if (!foundTextLen) {
delete [] pTextFind;
delete [] pTextReplace;
return -1;
}
This can happen above all when an empty line is hit. Then foundTextLen is 0 and the npp should proceed with the next line except when document's end it reached (see above).

There is another issue in file ReSearch.cxx when using "^[^(]+$". This pattern hits an empty line which is incorrect due to the fact that in this case c is 0 which isn't a legal character. But isinset yields true. Hence I'd suggest to add the condition c!= 0 to the if clause.
(855)
case CCL:
c = ci.CharAt(lp++);
if (!isinset(ap,c))
return NOTFOUND;
ap += BITBLK;
break;

Discussion

  • Don HO
    Don HO
    2014-08-17

    • status: open --> closed
    • Group: --> Next_major_release
     
  • Don HO
    Don HO
    2014-08-17

    Outdated.