Bug 399014

Summary: Text editor jumps when inserting a new bracket with auto-brackets.
Product: [Applications] kate Reporter: Simon Westersund <simon.westersund>
Component: generalAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: nate
Priority: NOR    
Version: 18.12.1   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In: 5.58
Sentry Crash Report:

Description Simon Westersund 2018-09-24 11:51:52 UTC
SUMMARY Text editor jumps when inserting a new bracket with auto-brackets.


STEPS TO REPRODUCE
1. Enable auto-brackets and scroll past last line of the editor.
2. Put the cursor on the last line of a document.
3. Scroll the document so that the last line isn't in the middle.
4. Insert a new parenthesis or other bracket.

EXPECTED RESULT
Inserts both a start and end parenthesis and the edited line stays where it is.

ACTUAL RESULT
Inserts both a start and end parenthesis but the edited line jumps to the middle of the screen (vertical scrolling happens).
Comment 1 Simon Westersund 2018-09-24 15:51:50 UTC
This bug also reproduces on KDE Neon with:
Kate version 18.08.1
KDE Frameworks 5.50.0
Qt 5.11.1
Comment 2 Dominik Haumann 2018-12-30 09:45:17 UTC
I wonder whether this is related to https://bugs.kde.org/show_bug.cgi?id=306745 - can you investigate?
Comment 3 Dominik Haumann 2018-12-30 09:46:01 UTC
Proposed patch: https://phabricator.kde.org/D17857
Comment 4 Simon Westersund 2019-01-11 17:40:19 UTC
(In reply to Dominik Haumann from comment #2)
> I wonder whether this is related to
> https://bugs.kde.org/show_bug.cgi?id=306745 - can you investigate?

Thanks for your replies Dominik, and sorry for my late response.

I tested this today with Kate 18.12.1, and this issue still reproduces. I updated the version of the issue, to keep it up-to-date.
(Other version numbers at the moment: KDE Frameworks 5.53.0, Qt 5.11.2 (built against 5.11.2), xcb windowing system)

I also had a look at https://bugs.kde.org/show_bug.cgi?id=306745 but that issue does not reproduce for me. That is, it does not reproduce by typing anything, except auto-bracket characters.
Comment 5 Christoph Cullmann 2019-03-04 19:07:52 UTC
Git commit 65e3b5462f1c4b7f3d5934bd336d0b5e9412e49e by Christoph Cullmann, on behalf of loh tar.
Committed on 04/03/2019 at 19:09.
Pushed by cullmann into branch 'master'.

DocumentPrivate: Don't scroll view when add auto-bracket at end of file

Summary:
...when 'Allow scrolling past the end of the document' is set

Test Plan:
See https://bugs.kde.org/show_bug.cgi?id=399014

Reviewers: #ktexteditor, cullmann

Reviewed By: #ktexteditor, cullmann

Subscribers: swestersund, cullmann, dhaumann, kwrite-devel, kde-frameworks-devel, #ktexteditor

Tags: #kate, #frameworks

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

M  +0    -1    src/document/katedocument.cpp

https://commits.kde.org/ktexteditor/65e3b5462f1c4b7f3d5934bd336d0b5e9412e49e
Comment 6 Lothar 2019-04-13 14:20:01 UTC
Git commit cfb0af25bdfac0d8f86b42db0b34a6bc9f9a361e by loh tar.
Committed on 13/04/2019 at 14:19.
Pushed by lohtar into branch 'master'.

ViewInternal: Fix makeVisible(..)

Summary:
- Proper calculation of new position to scroll
- Don't force to center cursor in view in most cases.
  This change looks slightly dangerous but nobody knows
  why that was done. So we give it a try now!
Related: bug 306745
FIXED-IN: 5.58

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

M  +1    -2    autotests/src/kateview_test.cpp
M  +1    -1    src/view/kateview.cpp
M  +6    -3    src/view/kateviewinternal.cpp

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