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;\">"
|
QStringLiteral(";padding:8px 12px;\">"
|
||||||
"<span style=\"font-size:small;color:gray;\">▶ diff</span> ") +
|
"<span style=\"font-size:small;color:gray;\">▶ diff</span> ") +
|
||||||
stats +
|
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;\">"
|
QStringLiteral("\" style=\"color:#2196f3;text-decoration:underline;\">"
|
||||||
"↗ Open in Diff Viewer</a>"
|
"↗ Open in Diff Viewer</a>"
|
||||||
"</td></tr></table>");
|
"</td></tr></table>");
|
||||||
|
|
@ -455,7 +455,7 @@ QString ChatRenderer::blockToHtml(const ChatBlock &block) const
|
||||||
: QStringLiteral("✎ Apply to ") + escapeHtml(filePath.section('/', -1));
|
: QStringLiteral("✎ Apply to ") + escapeHtml(filePath.section('/', -1));
|
||||||
inner += QStringLiteral(
|
inner += QStringLiteral(
|
||||||
"<div style=\"margin:-4px 0 6px 0;\">"
|
"<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;"
|
QStringLiteral("\" style=\"color:#4caf50;text-decoration:none;"
|
||||||
"font-size:small;padding:2px 8px;"
|
"font-size:small;padding:2px 8px;"
|
||||||
"border:1px solid #4caf50;border-radius:3px;\">") +
|
"border:1px solid #4caf50;border-radius:3px;\">") +
|
||||||
|
|
|
||||||
|
|
@ -839,13 +839,13 @@ void OllieKateView::onAnchorClicked(const QUrl &url)
|
||||||
{
|
{
|
||||||
if (url.scheme() == QStringLiteral("ollie-diff")) {
|
if (url.scheme() == QStringLiteral("ollie-diff")) {
|
||||||
bool ok;
|
bool ok;
|
||||||
int index = url.host().toInt(&ok);
|
int index = url.path().mid(1).toInt(&ok); // path is "/N"
|
||||||
if (ok) {
|
if (ok) {
|
||||||
showDiffBlock(index);
|
showDiffBlock(index);
|
||||||
}
|
}
|
||||||
} else if (url.scheme() == QStringLiteral("ollie-apply")) {
|
} else if (url.scheme() == QStringLiteral("ollie-apply")) {
|
||||||
bool ok;
|
bool ok;
|
||||||
int index = url.host().toInt(&ok);
|
int index = url.path().mid(1).toInt(&ok); // path is "/N"
|
||||||
if (ok) {
|
if (ok) {
|
||||||
applyCodeBlock(index);
|
applyCodeBlock(index);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Reference in New Issue