From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 04FEB15808F for ; Sat, 9 Apr 2022 16:07:49 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 731A2E096F; Sat, 9 Apr 2022 16:07:17 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 3485EE096C for ; Sat, 9 Apr 2022 16:07:17 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id A5F3634168C for ; Sat, 9 Apr 2022 16:07:15 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 0D3AC3AF for ; Sat, 9 Apr 2022 16:07:13 +0000 (UTC) From: "Andreas Sturmlechner" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Andreas Sturmlechner" Message-ID: <1649520184.04a3f091de5fc81e28e024ebe732081e6598fcea.asturm@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: kde-frameworks/ktexteditor/files/, kde-frameworks/ktexteditor/ X-VCS-Repository: repo/gentoo X-VCS-Files: kde-frameworks/ktexteditor/files/ktexteditor-5.92.0-fix-crash-w-stale-indexes.patch kde-frameworks/ktexteditor/files/ktexteditor-5.92.0-fix-toggle-comment.patch kde-frameworks/ktexteditor/ktexteditor-5.92.0-r1.ebuild X-VCS-Directories: kde-frameworks/ktexteditor/files/ kde-frameworks/ktexteditor/ X-VCS-Committer: asturm X-VCS-Committer-Name: Andreas Sturmlechner X-VCS-Revision: 04a3f091de5fc81e28e024ebe732081e6598fcea X-VCS-Branch: master Date: Sat, 9 Apr 2022 16:07:13 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 3eb32138-7367-410b-8a3f-d286c93b6f5d X-Archives-Hash: 57ed7e8631aa8067fc38081b52d1674a commit: 04a3f091de5fc81e28e024ebe732081e6598fcea Author: Andreas Sturmlechner gentoo org> AuthorDate: Sat Apr 9 15:37:28 2022 +0000 Commit: Andreas Sturmlechner gentoo org> CommitDate: Sat Apr 9 16:03:04 2022 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=04a3f091 kde-frameworks/ktexteditor: Fix crash and comment toggling Upstream commit ad82b876016367bd9765185dba84600985e5d0fd KDE-bug: https://bugs.kde.org/show_bug.cgi?id=451593 Upstream commit 1173d5184e8b073790556dbdba92a8b8abdd62dc KDE-bug: https://bugs.kde.org/show_bug.cgi?id=451471 Package-Manager: Portage-3.0.30, Repoman-3.0.3 Signed-off-by: Andreas Sturmlechner gentoo.org> ...xteditor-5.92.0-fix-crash-w-stale-indexes.patch | 29 ++++++ .../ktexteditor-5.92.0-fix-toggle-comment.patch | 112 +++++++++++++++++++++ .../ktexteditor/ktexteditor-5.92.0-r1.ebuild | 60 +++++++++++ 3 files changed, 201 insertions(+) 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 +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 +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\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\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\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 + diff --git a/kde-frameworks/ktexteditor/ktexteditor-5.92.0-r1.ebuild b/kde-frameworks/ktexteditor/ktexteditor-5.92.0-r1.ebuild new file mode 100644 index 000000000000..a09c6631374b --- /dev/null +++ b/kde-frameworks/ktexteditor/ktexteditor-5.92.0-r1.ebuild @@ -0,0 +1,60 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +PVCUT=$(ver_cut 1-2) +QTMIN=5.15.2 +VIRTUALX_REQUIRED="test" +inherit ecm kde.org + +DESCRIPTION="Framework providing a full text editor component" + +LICENSE="LGPL-2+" +KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~riscv ~x86" +IUSE="+editorconfig" + +RESTRICT="test" + +DEPEND=" + >=dev-qt/qtdeclarative-${QTMIN}:5 + >=dev-qt/qtgui-${QTMIN}:5 + >=dev-qt/qtprintsupport-${QTMIN}:5 + >=dev-qt/qtwidgets-${QTMIN}:5 + >=dev-qt/qtxml-${QTMIN}:5 + =kde-frameworks/karchive-${PVCUT}*:5 + =kde-frameworks/kauth-${PVCUT}*:5 + =kde-frameworks/kcodecs-${PVCUT}*:5 + =kde-frameworks/kcompletion-${PVCUT}*:5 + =kde-frameworks/kconfig-${PVCUT}*:5 + =kde-frameworks/kconfigwidgets-${PVCUT}*:5 + =kde-frameworks/kcoreaddons-${PVCUT}*:5 + =kde-frameworks/kguiaddons-${PVCUT}*:5 + =kde-frameworks/ki18n-${PVCUT}*:5 + =kde-frameworks/kiconthemes-${PVCUT}*:5 + =kde-frameworks/kio-${PVCUT}*:5 + =kde-frameworks/kitemviews-${PVCUT}*:5 + =kde-frameworks/kjobwidgets-${PVCUT}*:5 + =kde-frameworks/kparts-${PVCUT}*:5 + =kde-frameworks/ktextwidgets-${PVCUT}*:5 + =kde-frameworks/kwidgetsaddons-${PVCUT}*:5 + =kde-frameworks/kxmlgui-${PVCUT}*:5 + =kde-frameworks/sonnet-${PVCUT}*:5 + =kde-frameworks/syntax-highlighting-${PVCUT}*:5 + editorconfig? ( app-text/editorconfig-core-c ) +" +RDEPEND="${DEPEND}" +BDEPEND="test? ( >=kde-frameworks/kservice-${PVCUT}:5 )" + +PATCHES=( + "${FILESDIR}/${P}-fix-crash-w-stale-indexes.patch" # KDE-bug 451593 + "${FILESDIR}/${P}-fix-toggle-comment.patch" # KDE-bug 451471 +) + +src_configure() { + local mycmakeargs=( + $(cmake_use_find_package editorconfig EditorConfig) + ) + + ecm_src_configure +}