https://bugs.kde.org/show_bug.cgi?id=306745

Dominik Haumann <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Version Fixed In|                            |KDE Frameworks 5.43
             Status|REOPENED                    |RESOLVED
      Latest Commit|                            |https://commits.kde.org/kte
                   |                            |xteditor/2bed94b6d463fafbbc
                   |                            |b38f68bef90bcf18124cc6
         Resolution|---                         |FIXED

--- Comment #6 from Dominik Haumann <[email protected]> ---
Git commit 2bed94b6d463fafbbcb38f68bef90bcf18124cc6 by Dominik Haumann.
Committed on 24/01/2018 at 17:53.
Pushed by dhaumann into branch 'master'.

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

Summary:
This patch fixes a corner case for the following setup:
- enable "[x] Scroll past end of document"
- disable dynamic word wrap (i.e. you see a horizontal
  scrollbar for long lines)
- open a document with several lines
- make sure the last line is NOT empty

Let's say the last two lines look as follows

yy|yy # '|' denoes the cursor position
zzzzz

Make sure you scrolled past the end of the document (either
with the mouse or with Ctrl+Down). Note that line 'zzzzz' is
completely visible.

Now press 'cursor down'.

What happens is that the view contents jumps and the scrolling
behavior acts as if "Scroll past end of document" is not enabled.

Expected behavior is that the cursor position goes one line down,
but the scroll position remains completely unchanged.

The bug here is the following if clause:

    } else if (c > viewLineOffset(startPos(), linesDisplayed() -
m_minLinesVisible - 1)) {
        KTextEditor::Cursor scroll = viewLineOffset(c, -(linesDisplayed() -
m_minLinesVisible - 1));
        scrollPos(scroll, false, calledExternally);
    }

In the buggy case, c==(28, 1), and viewLineOffset()==(28,0).
This triggers the bug that in the last line of the document for
columns > 0 the scroll position is adapted.

The proposed fix here is to not compare cursor positions, but only
the lines. Clearly, 28 < 28 is not true, leading to no change in
the scroll position.
FIXED-IN: KDE Frameworks 5.43

Test Plan: make test

Reviewers: cullmann

Reviewed By: cullmann

Subscribers: #frameworks

Tags: #kate, #frameworks

Differential Revision: https://phabricator.kde.org/D10054

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

https://commits.kde.org/ktexteditor/2bed94b6d463fafbbcb38f68bef90bcf18124cc6

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to