kate: fix diff/apply URL scheme (use path not host to avoid QUrl IPv4 normalization)
This commit is contained in:
parent
84b3123461
commit
0599fbceb7
|
|
@ -354,7 +354,7 @@ QString ChatRenderer::subBlockToHtml(const SubBlock &sub, bool preserveWhitespac
|
|||
QStringLiteral(";padding:8px 12px;\">"
|
||||
"<span style=\"font-size:small;color:gray;\">▶ diff</span> ") +
|
||||
stats +
|
||||
QStringLiteral("<br><a href=\"ollie-diff://") + QString::number(idx) +
|
||||
QStringLiteral("<br><a href=\"ollie-diff:///") + QString::number(idx) +
|
||||
QStringLiteral("\" style=\"color:#2196f3;text-decoration:underline;\">"
|
||||
"↗ Open in Diff Viewer</a>"
|
||||
"</td></tr></table>");
|
||||
|
|
@ -455,7 +455,7 @@ QString ChatRenderer::blockToHtml(const ChatBlock &block) const
|
|||
: QStringLiteral("✎ Apply to ") + escapeHtml(filePath.section('/', -1));
|
||||
inner += QStringLiteral(
|
||||
"<div style=\"margin:-4px 0 6px 0;\">"
|
||||
"<a href=\"ollie-apply://") + QString::number(idx) +
|
||||
"<a href=\"ollie-apply:///") + QString::number(idx) +
|
||||
QStringLiteral("\" style=\"color:#4caf50;text-decoration:none;"
|
||||
"font-size:small;padding:2px 8px;"
|
||||
"border:1px solid #4caf50;border-radius:3px;\">") +
|
||||
|
|
|
|||
|
|
@ -839,13 +839,13 @@ void OllieKateView::onAnchorClicked(const QUrl &url)
|
|||
{
|
||||
if (url.scheme() == QStringLiteral("ollie-diff")) {
|
||||
bool ok;
|
||||
int index = url.host().toInt(&ok);
|
||||
int index = url.path().mid(1).toInt(&ok); // path is "/N"
|
||||
if (ok) {
|
||||
showDiffBlock(index);
|
||||
}
|
||||
} else if (url.scheme() == QStringLiteral("ollie-apply")) {
|
||||
bool ok;
|
||||
int index = url.host().toInt(&ok);
|
||||
int index = url.path().mid(1).toInt(&ok); // path is "/N"
|
||||
if (ok) {
|
||||
applyCodeBlock(index);
|
||||
}
|
||||
|
|
|
|||
Reference in New Issue