commit:     5a59820eaa645944a7136c4d623da15364d6701f
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Fri Aug  9 21:12:58 2024 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Sat Aug 10 07:56:44 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5a59820e

kde-misc/kdiff3: Handle 0 height QWidget in getNofVisibleLines

Upstream commit 5965591080306c66a48e961d264f212989fdae94

KDE-bug: https://bugs.kde.org/show_bug.cgi?id=487338

Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>

 .../files/kdiff3-1.11.2-fix-fp-exception.patch     | 55 ++++++++++++++++++++++
 kde-misc/kdiff3/kdiff3-1.11.2-r1.ebuild            | 49 +++++++++++++++++++
 2 files changed, 104 insertions(+)

diff --git a/kde-misc/kdiff3/files/kdiff3-1.11.2-fix-fp-exception.patch 
b/kde-misc/kdiff3/files/kdiff3-1.11.2-fix-fp-exception.patch
new file mode 100644
index 000000000000..b735d659f928
--- /dev/null
+++ b/kde-misc/kdiff3/files/kdiff3-1.11.2-fix-fp-exception.patch
@@ -0,0 +1,55 @@
+From 5965591080306c66a48e961d264f212989fdae94 Mon Sep 17 00:00:00 2001
+From: Michael Reeves <[email protected]>
+Date: Thu, 4 Jul 2024 07:50:21 -0400
+Subject: [PATCH] Handle 0 height QWidget in getNofVisibleLines
+
+BUG:487338
+FIXED-IN:1.11.3
+---
+ src/difftextwindow.cpp    | 8 +++++---
+ src/mergeresultwindow.cpp | 3 ++-
+ 2 files changed, 7 insertions(+), 4 deletions(-)
+
+diff --git a/src/difftextwindow.cpp b/src/difftextwindow.cpp
+index 783d13a66..85c0419fd 100644
+--- a/src/difftextwindow.cpp
++++ b/src/difftextwindow.cpp
+@@ -574,7 +574,9 @@ LineRef DiffTextWindow::convertDiff3LineIdxToLine(const 
LineType d3lIdx) const
+ */
+ LineRef getBestFirstLine(LineRef line, LineType nofLines, LineRef firstLine, 
LineType visibleLines)
+ {
+-    if(line < visibleLines) //well known result.
++    assert(visibleLines >= 0); // VisibleLines should not be < 0.
++
++    if(line < visibleLines || visibleLines == 0) //well known result.
+         return 0;
+ 
+     LineRef newFirstLine = firstLine;
+@@ -1412,8 +1414,8 @@ void DiffTextWindow::resizeEvent(QResizeEvent* e)
+ LineType DiffTextWindow::getNofVisibleLines() const
+ {
+     QFontMetrics fm = fontMetrics();
+-
+-    return height() / fm.lineSpacing() - 1;
++    //QWidget::height() may return 0 with certian configurations with 0 
length input files loaded.
++    return std::max((LineType)ceil(height() / fm.lineSpacing()) - 1, 0);
+ }
+ 
+ qint32 DiffTextWindow::getVisibleTextAreaWidth() const
+diff --git a/src/mergeresultwindow.cpp b/src/mergeresultwindow.cpp
+index b1100569d..46e50c945 100644
+--- a/src/mergeresultwindow.cpp
++++ b/src/mergeresultwindow.cpp
+@@ -471,7 +471,8 @@ qint32 MergeResultWindow::getVisibleTextAreaWidth() const
+ qint32 MergeResultWindow::getNofVisibleLines() const
+ {
+     QFontMetrics fm = fontMetrics();
+-    return (height() - 3) / fm.lineSpacing() - 2;
++    //QWidget::height() may return 0 with certian configurations with 0 
length input files loaded.
++    return std::max((qint32)ceil((height() - 3) / fm.lineSpacing()) - 2, 0);
+ }
+ 
+ qint32 MergeResultWindow::getTextXOffset() const
+-- 
+GitLab
+

diff --git a/kde-misc/kdiff3/kdiff3-1.11.2-r1.ebuild 
b/kde-misc/kdiff3/kdiff3-1.11.2-r1.ebuild
new file mode 100644
index 000000000000..35a32af7049c
--- /dev/null
+++ b/kde-misc/kdiff3/kdiff3-1.11.2-r1.ebuild
@@ -0,0 +1,49 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+ECM_HANDBOOK="optional"
+KFMIN=6.3.0
+QTMIN=6.6.2
+inherit ecm kde.org
+
+DESCRIPTION="Frontend to diff3 based on KDE Frameworks"
+HOMEPAGE="https://apps.kde.org/kdiff3/ https://userbase.kde.org/KDiff3";
+SRC_URI="mirror://kde/stable/${PN}/${P}.tar.xz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~arm64 ~ppc64 ~x86"
+IUSE=""
+
+COMMON_DEPEND="
+       >=dev-qt/qt5compat-${QTMIN}:6
+       >=dev-qt/qtbase-${QTMIN}:6[gui,widgets]
+       >=kde-frameworks/kconfig-${KFMIN}:6
+       >=kde-frameworks/kconfigwidgets-${KFMIN}:6
+       >=kde-frameworks/kcoreaddons-${KFMIN}:6
+       >=kde-frameworks/kcrash-${KFMIN}:6
+       >=kde-frameworks/ki18n-${KFMIN}:6
+       >=kde-frameworks/kio-${KFMIN}:6
+       >=kde-frameworks/ktextwidgets-${KFMIN}:6
+       >=kde-frameworks/kwidgetsaddons-${KFMIN}:6
+       >=kde-frameworks/kxmlgui-${KFMIN}:6
+"
+DEPEND="${COMMON_DEPEND}
+       >=dev-libs/boost-1.82
+"
+RDEPEND="${COMMON_DEPEND}
+       !${CATEGORY}/${PN}:5
+       sys-apps/diffutils
+"
+
+PATCHES=( "${FILESDIR}/${P}-fix-fp-exception.patch" ) # KDE-bug 487338
+
+src_configure() {
+       local mycmakeargs=(
+               -DBUILD_WITH_QT6=ON
+               # TODO: -DENABLE_GDBINDEX?
+       )
+       ecm_src_configure
+}

Reply via email to