| 173 | } |
| 174 | |
| 175 | KTextEditor::Range SourceCodeInsertion::insertionRange(int line) |
| 176 | { |
| 177 | if (line == 0 || !m_codeRepresentation) { |
| 178 | return KTextEditor::Range(line, 0, line, 0); |
| 179 | } |
| 180 | |
| 181 | KTextEditor::Range range(line - 1, m_codeRepresentation->line(line - 1).size(), line - 1, |
| 182 | m_codeRepresentation->line(line - 1).size()); |
| 183 | // If the context finishes on that line, then this will need adjusting |
| 184 | if (!m_context->rangeInCurrentRevision().contains(range)) { |
| 185 | range.start() = m_context->rangeInCurrentRevision().end(); |
| 186 | if (range.start().column() > 0) { |
| 187 | range.start() = range.start() - KTextEditor::Cursor(0, 1); |
| 188 | } |
| 189 | range.end() = range.start(); |
| 190 | } |
| 191 | |
| 192 | return range; |
| 193 | } |
| 194 | |
| 195 | bool SourceCodeInsertion::insertFunctionDeclaration(KDevelop::Declaration* declaration, const Identifier& id, const QString& body) |
| 196 | { |