MCPcopy Create free account
hub / github.com/KDE/kate / toggleFoldHunk

Method toggleFoldHunk

apps/lib/diff/diffeditor.cpp:458–486  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

456}
457
458void DiffEditor::toggleFoldHunk(int blockNumber)
459{
460 Q_ASSERT(isHunkLine(blockNumber));
461 int count = m_diffWidget->hunkLineCount(blockNumber);
462 if (count == 0) {
463 return;
464 }
465 if (count == -1) {
466 count = blockCount() - blockNumber;
467 }
468 if (count <= 0) {
469 return;
470 }
471
472 QTextBlock block = document()->findBlockByNumber(blockNumber).next();
473 int i = 0;
474 bool visible = !block.isVisible();
475 while (true) {
476 i++;
477 if (i == count || !block.isValid()) {
478 break;
479 }
480 block.setVisible(visible);
481 block = block.next();
482 }
483
484 viewport()->update();
485 m_lineNumArea->update();
486}
487
488int DiffEditor::firstVisibleLineNumber() const
489{

Callers 1

mousePressEventMethod · 0.80

Calls 4

hunkLineCountMethod · 0.80
setVisibleMethod · 0.80
isValidMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected