MCPcopy Create free account
hub / github.com/Codeya-IDE/deepin-ide / findString

Method findString

src/common/find/outputdocumentfind.cpp:87–110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

85}
86
87QString OutputDocumentFind::findString() const
88{
89 QTextCursor cursor = d->textCursor();
90 if (cursor.hasSelection() && cursor.block() != cursor.document()->findBlock(cursor.anchor()))
91 return QString(); // multi block selection
92
93 if (cursor.hasSelection())
94 return cursor.selectedText();
95
96 if (!cursor.atBlockEnd() && !cursor.hasSelection()) {
97 cursor.movePosition(QTextCursor::StartOfWord);
98 cursor.movePosition(QTextCursor::EndOfWord, QTextCursor::KeepAnchor);
99 QString s = cursor.selectedText();
100 for (const QChar c : s) {
101 if (!c.isLetterOrNumber() && c != QLatin1Char('_')) {
102 s.clear();
103 break;
104 }
105 }
106 return s;
107 }
108
109 return QString();
110}
111
112void OutputDocumentFind::findNext(const QString &txt)
113{

Callers

nothing calls this directly

Calls 5

textCursorMethod · 0.80
QStringClass · 0.50
documentMethod · 0.45
selectedTextMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected