MCPcopy Create free account
hub / github.com/dail8859/NotepadNext / findNext

Method findNext

src/Finder.cpp:49–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47}
48
49Sci_CharacterRange Finder::findNext(int startPos)
50{
51 did_latest_search_wrap = false;
52
53 if (text.isEmpty())
54 return {INVALID_POSITION, INVALID_POSITION};
55
56 const int pos = startPos == INVALID_POSITION ? editor->selectionEnd() : startPos;
57 const QByteArray textData = text.toUtf8();
58
59 editor->setTargetRange(pos, editor->length());
60 editor->setSearchFlags(search_flags);
61
62 if (editor->searchInTarget(textData.length(), textData.constData()) != INVALID_POSITION) {
63 return {static_cast<Sci_PositionCR>(editor->targetStart()), static_cast<Sci_PositionCR>(editor->targetEnd())};
64 }
65 else if (wrap) {
66 editor->setTargetRange(0, pos);
67 if (editor->searchInTarget(textData.length(), textData.constData()) != INVALID_POSITION) {
68 did_latest_search_wrap = true;
69
70 return {static_cast<Sci_PositionCR>(editor->targetStart()), static_cast<Sci_PositionCR>(editor->targetEnd())};
71 }
72 }
73
74 return {INVALID_POSITION, INVALID_POSITION};
75}
76
77Sci_CharacterRange Finder::findPrev()
78{

Callers 3

findMethod · 0.80
replaceMethod · 0.80
performNextSearchMethod · 0.80

Calls 3

isEmptyMethod · 0.80
lengthMethod · 0.80
setSearchFlagsMethod · 0.80

Tested by

no test coverage detected