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

Method textRemoved

plugins/patchreview/patchhighlighter.cpp:323–354  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

321}
322
323void PatchHighlighter::textRemoved( KTextEditor::Document* doc, const KTextEditor::Range& range, const QString& oldText ) {
324 Q_ASSERT(range.isValid());
325 if ( m_applying ) { // Do not interfere with patch application
326 return;
327 }
328 qCDebug(PLUGIN_PATCHREVIEW) << "removal range" << range;
329 qCDebug(PLUGIN_PATCHREVIEW) << "removed text" << oldText;
330
331 KTextEditor::Cursor cursor = range.start();
332 int startLine = cursor.line();
333 QStringList removedLines;
334 QStringList remainingLines;
335 if (startLine > 0) {
336 QString above = doc->line(--startLine);
337 removedLines << above;
338 remainingLines << above;
339 }
340
341 const QString changed = doc->line(cursor.line()) + QLatin1Char('\n');
342 const QStringView changedView = changed;
343 Q_ASSERT(cursor.column() <= changed.size());
344 removedLines << changedView.first(cursor.column()) + oldText + changedView.sliced(cursor.column());
345 remainingLines << changed;
346
347 if (doc->documentRange().end().line() > cursor.line()) {
348 QString below = doc->line(cursor.line() + 1);
349 removedLines << below;
350 remainingLines << below;
351 }
352
353 performContentChange(doc, removedLines, remainingLines, startLine + 1);
354}
355
356void PatchHighlighter::newlineRemoved(KTextEditor::Document* doc, int line) {
357 if ( m_applying ) { // Do not interfere with patch application

Callers

nothing calls this directly

Calls 7

isValidMethod · 0.45
startMethod · 0.45
lineMethod · 0.45
columnMethod · 0.45
sizeMethod · 0.45
firstMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected