| 489 | } |
| 490 | |
| 491 | void PatchHighlighter::newlineInserted(KTextEditor::Document* doc, const KTextEditor::Cursor& cursor) |
| 492 | { |
| 493 | if ( m_applying ) { // Do not interfere with patch application |
| 494 | return; |
| 495 | } |
| 496 | qCDebug(PLUGIN_PATCHREVIEW) << "newline range" << |
| 497 | KTextEditor::Range(cursor, KTextEditor::Cursor(cursor.line() + 1, 0)); |
| 498 | |
| 499 | int startLine = cursor.line(); |
| 500 | QStringList removedLines; |
| 501 | QStringList insertedLines; |
| 502 | if (startLine > 0) { |
| 503 | const QString above = doc->line(--startLine) + QLatin1Char('\n'); |
| 504 | removedLines << above; |
| 505 | insertedLines << above; |
| 506 | } |
| 507 | insertedLines << QStringLiteral("\n"); |
| 508 | if (doc->documentRange().end().line() > cursor.line()) { |
| 509 | const QString below = doc->line(cursor.line() + 1) + QLatin1Char('\n'); |
| 510 | removedLines << below; |
| 511 | insertedLines << below; |
| 512 | } |
| 513 | |
| 514 | performContentChange(doc, removedLines, insertedLines, startLine + 1); |
| 515 | } |
| 516 | |
| 517 | PatchHighlighter::PatchHighlighter(KompareDiff2::DiffModel* model, IDocument* kdoc, PatchReviewPlugin* plugin, |
| 518 | bool updatePatchFromEdits) |