| 87 | } |
| 88 | |
| 89 | inline 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 |
| 110 | static QString printRange(const KTextEditor::Range& r) |