diff options
author | V3n3RiX <venerix@koprulu.sector> | 2022-04-16 13:07:24 +0100 |
---|---|---|
committer | V3n3RiX <venerix@koprulu.sector> | 2022-04-16 13:07:24 +0100 |
commit | 0c100b7dd2b30e75b799d806df4ef899fd98e1ea (patch) | |
tree | 464c922e949c7e4d5d891fb2cdda5daee5612537 /kde-frameworks/ktexteditor/files | |
parent | e68d405c5d712af4387159df07e226217bdda049 (diff) |
gentoo resync : 16.04.2022
Diffstat (limited to 'kde-frameworks/ktexteditor/files')
-rw-r--r-- | kde-frameworks/ktexteditor/files/ktexteditor-5.92.0-fix-crash-w-stale-indexes.patch | 29 | ||||
-rw-r--r-- | kde-frameworks/ktexteditor/files/ktexteditor-5.92.0-fix-toggle-comment.patch | 112 |
2 files changed, 141 insertions, 0 deletions
diff --git a/kde-frameworks/ktexteditor/files/ktexteditor-5.92.0-fix-crash-w-stale-indexes.patch b/kde-frameworks/ktexteditor/files/ktexteditor-5.92.0-fix-crash-w-stale-indexes.patch new file mode 100644 index 000000000000..b77a72a3e502 --- /dev/null +++ b/kde-frameworks/ktexteditor/files/ktexteditor-5.92.0-fix-crash-w-stale-indexes.patch @@ -0,0 +1,29 @@ +From ad82b876016367bd9765185dba84600985e5d0fd Mon Sep 17 00:00:00 2001 +From: Waqar Ahmed <waqar.17a@gmail.com> +Date: Fri, 18 Mar 2022 10:14:28 +0500 +Subject: [PATCH] Fix crash with stale indexes + +BUG: 451593 +--- + src/completion/katecompletionmodel.cpp | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/src/completion/katecompletionmodel.cpp b/src/completion/katecompletionmodel.cpp +index 1e241f0d..d9bb8421 100644 +--- a/src/completion/katecompletionmodel.cpp ++++ b/src/completion/katecompletionmodel.cpp +@@ -914,6 +914,11 @@ QModelIndex KateCompletionModel::mapToSource(const QModelIndex &proxyIndex) cons + } + + if (Group *g = groupOfParent(proxyIndex)) { ++ if (!m_rowTable.contains(g)) { ++ qWarning() << Q_FUNC_INFO << "Stale proxy index for which there is no group"; ++ return {}; ++ } ++ + if (proxyIndex.row() >= 0 && proxyIndex.row() < (int)g->filtered.size()) { + ModelRow source = g->filtered[proxyIndex.row()].sourceRow(); + return source.second.sibling(source.second.row(), proxyIndex.column()); +-- +GitLab + diff --git a/kde-frameworks/ktexteditor/files/ktexteditor-5.92.0-fix-toggle-comment.patch b/kde-frameworks/ktexteditor/files/ktexteditor-5.92.0-fix-toggle-comment.patch new file mode 100644 index 000000000000..bac8cd017e68 --- /dev/null +++ b/kde-frameworks/ktexteditor/files/ktexteditor-5.92.0-fix-toggle-comment.patch @@ -0,0 +1,112 @@ +From 1173d5184e8b073790556dbdba92a8b8abdd62dc Mon Sep 17 00:00:00 2001 +From: Waqar Ahmed <waqar.17a@gmail.com> +Date: Mon, 14 Mar 2022 09:44:54 +0500 +Subject: [PATCH] Fix toggle comment with space at the start + +BUG: 451471 +--- + autotests/src/katedocument_test.cpp | 48 +++++++++++++++++++++++++++++ + autotests/src/katedocument_test.h | 1 + + src/document/katedocument.cpp | 10 +++++- + 3 files changed, 58 insertions(+), 1 deletion(-) + +diff --git a/autotests/src/katedocument_test.cpp b/autotests/src/katedocument_test.cpp +index f0946829..a842f960 100644 +--- a/autotests/src/katedocument_test.cpp ++++ b/autotests/src/katedocument_test.cpp +@@ -851,4 +851,52 @@ void KateDocumentTest::testKeepUndoOverReload() + QCOMPARE(doc.text(), insertedText + initialText); + } + ++void KateDocumentTest::testToggleComment() ++{ ++ { // BUG: 451471 ++ KTextEditor::DocumentPrivate doc; ++ QVERIFY(doc.highlightingModes().contains(QStringLiteral("Python"))); ++ doc.setHighlightingMode(QStringLiteral("Python")); ++ const QString original = QStringLiteral("import hello;\n def method():"); ++ doc.setText(original); ++ QVERIFY(doc.lines() == 2); ++ ++ doc.commentSelection(doc.documentRange(), {1, 2}, false, 0); // 0 == ToggleComment ++ QCOMPARE(doc.text(), QStringLiteral("#import hello;\n #def method():")); ++ ++ doc.commentSelection(doc.documentRange(), {1, 2}, false, 0); // 0 == ToggleComment ++ QCOMPARE(doc.text(), original); ++ } ++ ++ { // Comment C++; ++ KTextEditor::DocumentPrivate doc; ++ QVERIFY(doc.highlightingModes().contains(QStringLiteral("C++"))); ++ doc.setHighlightingMode(QStringLiteral("C++")); ++ QString original = QStringLiteral("#include<iostream>\nint main()\n{\nreturn 0;\n}\n"); ++ doc.setText(original); ++ QVERIFY(doc.lines() == 6); ++ ++ doc.commentSelection(doc.documentRange(), {5, 0}, false, 0); // 0 == ToggleComment ++ QCOMPARE(doc.text(), QStringLiteral("// #include<iostream>\n// int main()\n// {\n// return 0;\n// }\n")); ++ ++ doc.commentSelection(doc.documentRange(), {5, 0}, false, 0); // 0 == ToggleComment ++ QCOMPARE(doc.text(), original); ++ ++ // Comment just a portion ++ doc.commentSelection(Range(1, 0, 1, 3), Cursor(1, 3), false, 0); ++ QCOMPARE(doc.text(), QStringLiteral("#include<iostream>\n/*int*/ main()\n{\nreturn 0;\n}\n")); ++ doc.commentSelection(Range(1, 0, 1, 7), Cursor(1, 3), false, 0); ++ QCOMPARE(doc.text(), original); ++ ++ // mixed, one line commented, one not => both get commented ++ original = QStringLiteral(" // int main()\n{}"); ++ doc.setText(original); ++ doc.commentSelection(doc.documentRange(), {1, 2}, false, 0); ++ QCOMPARE(doc.text(), QStringLiteral("// // int main()\n// {}")); ++ doc.commentSelection(doc.documentRange(), {1, 2}, false, 0); ++ // after uncommenting, we get original text back with one line commented ++ QCOMPARE(doc.text(), original); ++ } ++} ++ + #include "katedocument_test.moc" +diff --git a/autotests/src/katedocument_test.h b/autotests/src/katedocument_test.h +index c3b24b4c..0076f879 100644 +--- a/autotests/src/katedocument_test.h ++++ b/autotests/src/katedocument_test.h +@@ -46,6 +46,7 @@ private Q_SLOTS: + void testIndentOnPaste(); + void testAboutToSave(); + void testKeepUndoOverReload(); ++ void testToggleComment(); + }; + + #endif // KATE_DOCUMENT_TEST_H +diff --git a/src/document/katedocument.cpp b/src/document/katedocument.cpp +index 56e8fc7d..b72592b6 100644 +--- a/src/document/katedocument.cpp ++++ b/src/document/katedocument.cpp +@@ -3995,7 +3995,11 @@ bool KTextEditor::DocumentPrivate::removeStartLineCommentFromSelection(KTextEdit + bool allLinesAreCommented = true; + for (int line = endLine; line >= startLine; line--) { + const auto ln = m_buffer->plainLine(line); +- if (!ln->startsWith(shortCommentMark) && !ln->startsWith(longCommentMark)) { ++ const QString &text = ln->text(); ++ QStringView textView(text.data(), text.size()); ++ // Must trim any spaces at the beginning ++ textView = textView.trimmed(); ++ if (!textView.startsWith(shortCommentMark) && !textView.startsWith(longCommentMark)) { + allLinesAreCommented = false; + break; + } +@@ -4031,6 +4035,10 @@ void KTextEditor::DocumentPrivate::commentSelection(KTextEditor::Range selection + + int startAttrib = 0; + Kate::TextLine ln = kateTextLine(line); ++ if (!ln) { ++ qWarning() << __FUNCTION__ << __LINE__ << "Unexpected null TextLine for " << line << " lineCount: " << lines(); ++ return; ++ } + + if (selectionCol < ln->length()) { + startAttrib = ln->attribute(selectionCol); +-- +GitLab + |