MCPcopy Create free account
hub / github.com/SpartanJ/eepp / findPrevText

Method findPrevText

src/eepp/ui/tools/uidocfindreplace.cpp:442–477  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

440}
441
442bool UIDocFindReplace::findPrevText( TextSearchParams& search ) {
443 if ( search.text.empty() )
444 search.text = mLastSearch;
445
446 mLastSearch = search.text;
447 TextRange range = mDoc->getDocRange();
448 TextPosition from = mDoc->getSelection( true ).start();
449 if ( search.range.isValid() ) {
450 range = mDoc->sanitizeRange( search.range ).normalized();
451 from = from < range.start() ? range.start() : from;
452 }
453
454 String txt( search.text );
455 if ( search.escapeSequences )
456 txt.unescape();
457
458 TextRange found = mDoc->findLast( txt, from, search.caseSensitive, search.wholeWord,
459 search.type, search.range )
460 .result;
461 if ( found.isValid() ) {
462 mDoc->setSelection( found );
463 mFindInput->removeClass( "error" );
464 return true;
465 } else {
466 found = mDoc->findLast( txt, range.end(), search.caseSensitive, search.wholeWord,
467 search.type, range )
468 .result;
469 if ( found.isValid() ) {
470 mDoc->setSelection( found );
471 mFindInput->removeClass( "error" );
472 return true;
473 }
474 }
475 mFindInput->addClass( "error" );
476 return false;
477}
478
479bool UIDocFindReplace::findNextText( TextSearchParams& search ) {
480 if ( search.text.empty() )

Callers

nothing calls this directly

Calls 13

getDocRangeMethod · 0.80
normalizedMethod · 0.80
sanitizeRangeMethod · 0.80
findLastMethod · 0.80
removeClassMethod · 0.80
addClassMethod · 0.80
emptyMethod · 0.45
startMethod · 0.45
getSelectionMethod · 0.45
isValidMethod · 0.45
unescapeMethod · 0.45
setSelectionMethod · 0.45

Tested by

no test coverage detected