MCPcopy Create free account
hub / github.com/KDE/kdevelop / rangeText

Function rangeText

kdevplatform/language/codegen/documentchangeset.cpp:89–107  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87}
88
89inline QString rangeText(const KTextEditor::Range& range, const QStringList& textLines)
90{
91 QStringList ret;
92 ret.reserve(range.end().line() - range.start().line() + 1);
93 for (int line = range.start().line(); line <= range.end().line(); ++line) {
94 const QString lineText = textLines.at(line);
95 int startColumn = 0;
96 int endColumn = lineText.length();
97 if (line == range.start().line()) {
98 startColumn = range.start().column();
99 }
100 if (line == range.end().line()) {
101 endColumn = range.end().column();
102 }
103 ret << lineText.mid(startColumn, endColumn - startColumn);
104 }
105
106 return ret.join(QLatin1Char('\n'));
107}
108
109// need to have it as otherwise the arguments can exceed the maximum of 10
110static QString printRange(const KTextEditor::Range& r)

Callers 1

generateNewTextMethod · 0.85

Calls 9

midMethod · 0.80
joinMethod · 0.80
reserveMethod · 0.45
lineMethod · 0.45
endMethod · 0.45
startMethod · 0.45
atMethod · 0.45
lengthMethod · 0.45
columnMethod · 0.45

Tested by

no test coverage detected