- fix: Word on the last line's end can't be searched.

This commit is contained in:
Roy Qu 2023-02-25 22:30:34 +08:00
parent 5bef664106
commit 12983f5ae0
3 changed files with 7 additions and 3 deletions

View File

@ -7,6 +7,7 @@ Red Panda C++ Version 2.15
- change: Default value for the debugger debugger panel "memory view's columns" is changed from 8 to 16.
- change: Default value for the debugger debugger panel "memory view's rows" is changed from 8 to 16.
- enhancement: Display hex value as ascii chars in the debugger panel memory view tab.
- fix: Word on the last line's end can't be searched.
Red Panda C++ Version 2.14

View File

@ -5173,7 +5173,7 @@ int QSynEdit::searchReplace(const QString &sSearch, const QString &sReplace, Sea
// Is the search result entirely in the search range?
bool isInValidSearchRange = true;
int first = nFound;
int last = nFound + nSearchLen;
int last = nFound + nSearchLen -1;
if ((mActiveSelectionMode == SelectionMode::Normal)
|| !sOptions.testFlag(ssoSelectedOnly)) {
if (((ptCurrent.line == ptStart.line) && (first < ptStart.ch)) ||
@ -5238,10 +5238,11 @@ int QSynEdit::searchReplace(const QString &sSearch, const QString &sReplace, Sea
}
// search next / previous line
if (bBackward)
if (bBackward) {
ptCurrent.line--;
else
} else {
ptCurrent.line++;
}
if (((ptCurrent.line < ptStart.line) || (ptCurrent.line > ptEnd.line))
&& bFromCursor ){
if (!sOptions.testFlag(ssoWrapAround) && confirmAroundCallback && !confirmAroundCallback())

View File

@ -53,6 +53,8 @@ int RegexSearcher::findAll(const QString &text)
QRegularExpressionMatchIterator it = mRegex.globalMatch(text);
while (it.hasNext()) {
QRegularExpressionMatch match = it.next();
if (match.capturedLength()==0)
continue;
mLengths.append(match.capturedLength());
mResults.append(match.capturedStart());
}