Bug 277422

Summary: wrong selection start-point
Product: [Applications] kate Reporter: Milian Wolff <mail>
Component: partAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: joeyadams3.14159
Priority: HI    
Version: SVN   
Target Milestone: ---   
Platform: Unlisted Binaries   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Milian Wolff 2011-07-09 14:47:11 UTC
Version:           SVN
OS:                Linux

Just found this on IRC, and I've hunted for a way to reproduce this annoying bug for ages:

[15:09] <JoeyA> [05:29:35] Can anyone reproduce this really annoying bug?  1.) Open a file with text. 2.) Click somewhere in the text, and drag just a little bit (without selecting anything). 3.) Click somewhere else in the text. 4.) Shift-click to another place.
[15:09] <JoeyA> [05:30:01] Expected behavior: selects from B to C.
[15:09] <JoeyA> [05:30:36] Actual behavior (in Kate 3.6.3 on KDE 4.6.3): selects from A to C.


Reproducible: Didn't try

Steps to Reproduce:
open file with three lines:

A
B
C

Click behind A and drag to the right, without selecting anything
Click behind C
Shift-Click after the B

Actual Results:  
selection from after the A to after the B

Expected Results:  
selection from after the B to after the C

I'll try to write a unit test, but if someone else wants to fix it, go ahead :)
Comment 1 Milian Wolff 2011-07-09 20:13:21 UTC
Git commit 9d20beff942c2bb3c106a0c5474e522ae2637abd by Milian Wolff.
Committed on 09/07/2011 at 22:10.
Pushed by mwolff into branch 'master'.

properly invalidate m_selectionAnchor when invalidating the selectionCache

fixes wrong selection start-point under some conditions, adds unit test

BUG: 277422

M  +84   -0    part/tests/kateview_test.cpp     
M  +2    -0    part/tests/kateview_test.h     
M  +1    -0    part/view/kateviewinternal.cpp     

http://commits.kde.org/kate/9d20beff942c2bb3c106a0c5474e522ae2637abd
Comment 2 Joey Adams 2011-07-10 01:35:28 UTC
Wow, that was fast (that was me on IRC).  Thanks!

I hand-patched this fix onto the Fedora 15 srpm (kdelibs-4.6.3-5.fc15.src.rpm), and it worked.
Comment 3 Christoph Cullmann 2011-07-10 10:21:24 UTC
Git commit 070c5c7ebcf5bd81d378b3d7c2916764a8e9db36 by Christoph Cullmann, on behalf of Milian Wolff.
Committed on 09/07/2011 at 22:10.
Pushed by cullmann into branch 'KDE/4.7'.

properly invalidate m_selectionAnchor when invalidating the selectionCache

fixes wrong selection start-point under some conditions, adds unit test

BUG: 277422

M  +84   -0    part/tests/kateview_test.cpp     
M  +2    -0    part/tests/kateview_test.h     
M  +1    -0    part/view/kateviewinternal.cpp     

http://commits.kde.org/kate/070c5c7ebcf5bd81d378b3d7c2916764a8e9db36
Comment 4 Milian Wolff 2011-07-10 15:07:53 UTC
@joey: Please report such bugs directly on bugs.kde.org next time.

Thanks for the reproducible steps though :)