| 456 | } |
| 457 | |
| 458 | void 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 | |
| 488 | int DiffEditor::firstVisibleLineNumber() const |
| 489 | { |
no test coverage detected