MCPcopy Create free account
hub / github.com/Palm1r/QodeAssist / getLineText

Method getLineText

context/DocumentContextReader.cpp:45–67  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43}
44
45QString DocumentContextReader::getLineText(int lineNumber, int cursorPosition) const
46{
47 if (!m_document || lineNumber < 0)
48 return QString();
49
50 QTextBlock block = m_document->begin();
51 int currentLine = 0;
52
53 while (block.isValid()) {
54 if (currentLine == lineNumber) {
55 QString text = block.text();
56 if (cursorPosition >= 0 && cursorPosition <= text.length()) {
57 text = text.left(cursorPosition);
58 }
59 return text;
60 }
61
62 block = block.next();
63 currentLine++;
64 }
65
66 return QString();
67}
68
69QString DocumentContextReader::getContextBefore(
70 int lineNumber, int cursorPosition, int linesCount) const

Callers 1

TEST_FFunction · 0.80

Calls 2

isValidMethod · 0.45
textMethod · 0.45

Tested by 1

TEST_FFunction · 0.64