MCPcopy Create free account
hub / github.com/baldurk/renderdoc / find

Method find

qrenderdoc/Windows/ShaderViewer.cpp:6759–6845  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6757}
6758
6759void ShaderViewer::find(bool down)
6760{
6761 ScintillaEdit *cur = currentScintilla();
6762
6763 if(!cur)
6764 return;
6765
6766 QString find = m_FindReplace->findText();
6767
6768 sptr_t flags = 0;
6769
6770 if(m_FindReplace->matchCase())
6771 flags |= SCFIND_MATCHCASE;
6772 if(m_FindReplace->matchWord())
6773 flags |= SCFIND_WHOLEWORD;
6774 if(m_FindReplace->regexp())
6775 flags |= SCFIND_REGEXP | SCFIND_POSIX;
6776
6777 FindReplace::SearchContext context = m_FindReplace->context();
6778
6779 QString findHash = QFormatStr("%1%2%3%4").arg(find).arg(flags).arg((int)context).arg(down);
6780
6781 if(findHash != m_FindState.hash)
6782 {
6783 m_FindState.hash = findHash;
6784 m_FindState.start = 0;
6785 m_FindState.end = cur->length();
6786 m_FindState.offset = cur->currentPos();
6787 if(down && cur->selectionStart() == m_FindState.offset &&
6788 cur->selectionEnd() - m_FindState.offset == find.length())
6789 m_FindState.offset += find.length();
6790 }
6791
6792 int start = m_FindState.start + m_FindState.offset;
6793 int end = m_FindState.end;
6794
6795 if(!down)
6796 end = m_FindState.start;
6797
6798 QPair<int, int> result = cur->findText(flags, find.toUtf8().data(), start, end);
6799
6800 m_FindState.prevResult = result;
6801
6802 if(result.first == -1)
6803 {
6804 sptr_t maxOffset = down ? 0 : m_FindState.end;
6805
6806 // if we're at offset 0 searching down, there are no results. Same for offset max and
6807 // searching up
6808 if(m_FindState.offset == maxOffset)
6809 return;
6810
6811 // otherwise, we can wrap the search around
6812
6813 if(context == FindReplace::AllFiles)
6814 {
6815 cur = nextScintilla(cur);
6816 ToolWindowManager::raiseToolWindow(cur);

Callers 15

parentMethod · 0.45
UnregisterReplacementMethod · 0.45
GetPyObjectMethod · 0.45
HasPyObjectMethod · 0.45
DecMethod · 0.45
IncMethod · 0.45
check_interfaceFunction · 0.45
LoadMethod · 0.45
UpdateBookmarkMenuMethod · 0.45
stringRepMethod · 0.45
NextBookmarkMethod · 0.45

Calls 14

findTextMethod · 0.80
matchCaseMethod · 0.80
matchWordMethod · 0.80
regexpMethod · 0.80
contextMethod · 0.80
currentPosMethod · 0.80
selectionStartMethod · 0.80
selectionEndMethod · 0.80
toUtf8Method · 0.80
setSelectionMethod · 0.80
lineFromPositionMethod · 0.80
argMethod · 0.45

Tested by

no test coverage detected