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

Method newlineInserted

plugins/patchreview/patchhighlighter.cpp:491–515  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

489}
490
491void 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
517PatchHighlighter::PatchHighlighter(KompareDiff2::DiffModel* model, IDocument* kdoc, PatchReviewPlugin* plugin,
518 bool updatePatchFromEdits)

Callers

nothing calls this directly

Calls 4

RangeClass · 0.70
CursorClass · 0.70
lineMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected