Fwd: [ktexteditor] /: Revert Fix: View jumps when Scroll past end of document is enabled

Dominik Haumann dhaumann at kde.org
Tue Mar 20 18:55:46 UTC 2018


Dear packagers,

unfortunately, a bug slipped into the cursor navigation while
trying to fix another minor cursor navigation issue.

The affected KTextEditor frameworks are 5.43 and 5.44.

The fix below reverts the attempt to fix the bug, and will
be in 5.45. If you want, you can backport this commit below.

Sorry for the inconvenience,
Dominik


---------- Forwarded message ----------
From: Dominik Haumann <null at kde.org>
Date: Tue, Mar 20, 2018 at 7:52 PM
Subject: [ktexteditor] /: Revert Fix: View jumps when Scroll past end
of document is enabled
To: kde-commits at kde.org


Git commit e75bde233b9fe6b1a7d24cc63fa9baf9e89de895 by Dominik Haumann.
Committed on 20/03/2018 at 18:51.
Pushed by dhaumann into branch 'master'.

Revert Fix: View jumps when Scroll past end of document is enabled

Unfortunately, this introduced a regression that scrolling down in
dynamically wrapped lines did not move the view at all. We need
to find a better fix, and introduce a unit test.

CCBUG: 306745
BUG: 391838
FIXED-IN: 5.45

M  +2    -0    autotests/src/kateview_test.cpp
M  +1    -1    src/view/kateviewinternal.cpp

https://commits.kde.org/ktexteditor/e75bde233b9fe6b1a7d24cc63fa9baf9e89de895

diff --git a/autotests/src/kateview_test.cpp b/autotests/src/kateview_test.cpp
index ba9cd215..d9b56725 100644
--- a/autotests/src/kateview_test.cpp
+++ b/autotests/src/kateview_test.cpp
@@ -293,6 +293,7 @@ void KateViewTest::testKillline()

 void KateViewTest::testScrollPastEndOfDocument()
 {
+#if 0 // bug still exists, see bug 306745
     KTextEditor::DocumentPrivate doc;
     doc.setText(QStringLiteral("0000000000\n"
                                "1111111111\n"
@@ -322,6 +323,7 @@ void KateViewTest::testScrollPastEndOfDocument()
     QCOMPARE(view->cursorPosition(), KTextEditor::Cursor(4, 5));
     // verify, that only lines 3333333333 and 4444444444 are still visible.
     QCOMPARE(view->firstDisplayedLineInternal(KTextEditor::View::RealLine), 3);
+#endif
 }

 void KateViewTest::testFoldFirstLine()
diff --git a/src/view/kateviewinternal.cpp b/src/view/kateviewinternal.cpp
index dc88c948..c56bcff9 100644
--- a/src/view/kateviewinternal.cpp
+++ b/src/view/kateviewinternal.cpp
@@ -709,7 +709,7 @@ void KateViewInternal::makeVisible(const
KTextEditor::Cursor &c, int endCol, boo
     } else if (center && (c < startPos() || c > endPos())) {
         KTextEditor::Cursor scroll = viewLineOffset(c,
-int(linesDisplayed()) / 2);
         scrollPos(scroll, false, calledExternally);
-    } else if (c.line() > viewLineOffset(startPos(), linesDisplayed()
- m_minLinesVisible - 1).line()) {
+    } else if (c > viewLineOffset(startPos(), linesDisplayed() -
m_minLinesVisible - 1)) {
         KTextEditor::Cursor scroll = viewLineOffset(c,
-(linesDisplayed() - m_minLinesVisible - 1));
         scrollPos(scroll, false, calledExternally);
     } else if (c < viewLineOffset(startPos(), m_minLinesVisible)) {


More information about the KWrite-Devel mailing list