Bug 374163

Summary: [PATCH] When dragging a text in forward direction a selection is "dragged" by a double distance
Product: [Frameworks and Libraries] frameworks-ktexteditor Reporter: Serge Roussak <beaux_monde>
Component: generalAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: beaux_monde
Priority: HI    
Version First Reported In: 5.29.0   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed/Implemented In: KDE Frameworks 5.30
Sentry Crash Report:
Attachments: The screenshots
The patch

Description Serge Roussak 2016-12-26 12:25:40 UTC
Created attachment 102998 [details]
The screenshots

When I select a text in the katepart-driven editor and try to drag it in forward direction then selection of the inserted text is shifted by the size of the dragged text. See the screenshots for explanation. At the first picture I had selected the 'Line 2'. At the second I tried to drag it to the empty line and it was dragged, but a selection is "jumped" at a somewhere unexpected place.
Comment 1 Serge Roussak 2016-12-26 12:27:15 UTC
Created attachment 102999 [details]
The patch
Comment 2 Dominik Haumann 2017-01-03 09:01:02 UTC
Indeed, from reading the code, it seems this issue already exists for years. Strange no one ever stumbled over this.
Comment 3 Dominik Haumann 2017-01-03 11:35:43 UTC
Pending review request with unit test: https://git.reviewboard.kde.org/r/129758/
Comment 4 Dominik Haumann 2017-01-07 11:15:53 UTC
Git commit a4ad36c174f498cc884acaefe01b8443f69f1d79 by Dominik Haumann.
Committed on 07/01/2017 at 11:15.
Pushed by dhaumann into branch 'master'.

Fix: Forward dragging text results in wrong selection

Thanks to Serge Roussak for the patch!

REVIEW: 129758

M  +67   -0    autotests/src/kateview_test.cpp
M  +2    -0    autotests/src/kateview_test.h
M  +8    -4    src/view/kateviewinternal.cpp

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