| 66 | | MarkType::markType25 | MarkType::markType26 | MarkType::markType27; |
| 67 | |
| 68 | void PatchHighlighter::showToolTipForMark(const QPoint& pos, KTextEditor::MovingRange* markRange) |
| 69 | { |
| 70 | if( currentTooltipMark == markRange && currentTooltip ) |
| 71 | return; |
| 72 | delete currentTooltip; |
| 73 | |
| 74 | //Got the difference |
| 75 | auto* const diff = m_ranges[markRange]; |
| 76 | |
| 77 | QString html; |
| 78 | #if 0 |
| 79 | if( diff->hasConflict() ) |
| 80 | html += i18n( "<b><span style=\"color:red\">Conflict</span></b><br/>" ); |
| 81 | #endif |
| 82 | |
| 83 | KompareDiff2::DifferenceStringList lines; |
| 84 | |
| 85 | html += QLatin1String("<b>"); |
| 86 | if( diff->applied() ) { |
| 87 | if( !m_plugin->patch()->isAlreadyApplied() ) |
| 88 | html += i18n( "Applied.<br/>" ); |
| 89 | |
| 90 | if( isInsertion( diff ) ) { |
| 91 | html += i18n( "Insertion<br/>" ); |
| 92 | } else { |
| 93 | if( isRemoval( diff ) ) |
| 94 | html += i18n( "Removal<br/>" ); |
| 95 | html += i18n( "Previous:<br/>" ); |
| 96 | lines = diff->sourceLines(); |
| 97 | } |
| 98 | } else { |
| 99 | if( m_plugin->patch()->isAlreadyApplied() ) |
| 100 | html += i18n( "Reverted.<br/>" ); |
| 101 | |
| 102 | if( isRemoval( diff ) ) { |
| 103 | html += i18n( "Removal<br/>" ); |
| 104 | } else { |
| 105 | if( isInsertion( diff ) ) |
| 106 | html += i18n( "Insertion<br/>" ); |
| 107 | |
| 108 | html += i18n( "Alternative:<br/>" ); |
| 109 | |
| 110 | lines = diff->destinationLines(); |
| 111 | } |
| 112 | } |
| 113 | html += QLatin1String("</b>"); |
| 114 | |
| 115 | for (auto* line : std::as_const(lines)) { |
| 116 | uint currentPos = 0; |
| 117 | const QString& string = line->string(); |
| 118 | |
| 119 | const auto markers = line->markerList(); |
| 120 | |
| 121 | for (auto* marker : markers) { |
| 122 | const QString spanText = string.mid( currentPos, marker->offset() - currentPos ).toHtmlEscaped(); |
| 123 | if (marker->type() == KompareDiff2::Marker::End |
| 124 | && (currentPos != 0 || marker->offset() != static_cast<uint>(string.size()))) { |
| 125 | html += QLatin1String("<b><span style=\"background:#FFBBBB\">") + spanText + QLatin1String("</span></b>"); |
nothing calls this directly
no test coverage detected