Bug 213693 - Cursor position not updated after a keyboard text-search
Summary: Cursor position not updated after a keyboard text-search
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Platform: Debian testing Linux
: NOR normal (vote)
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-11-08 14:54 UTC by Per (phobie)
Modified: 2011-08-08 11:56 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Per (phobie) 2009-11-08 14:54:53 UTC
Version:           3.3.2 (using KDE 4.3.2)
OS:                Linux
Installed from:    Debian testing/unstable Packages

If you do a selection followed by a search with the keyboard, the internal cursor position does not seem to be updated and the next selection will be wrong.


How to reproduce:

Create the following text!
'''
AAA
YYYXXXYYY
AAA
YYYXXXYYY
'''
Ctrl+f search for "XXX"
Move the cursor to the beginning of the file
F3 (selects XXX in the second line)
Shift+End (selects XXXYYY in the second line)
F3 twice (selects XXX in the 4th line)
Shift+End ...

This should select XXXYYY in the 4th line, but it selects everything from the last hit (second line) to the end of the 4th line.

The bug can also be reproduced with Shift+Pos1, Shift+PageUp and Shift+PageDown

This can not be reproduced with the next button on the search window, because that steals focus from the text window, but this is an other bug...
Comment 1 Pascal Létourneau 2009-11-08 21:49:14 UTC
SVN commit 1046480 by pletourn:

Invalidate the selection anchor when the selection is set programmatically

BUG:213693


 M  +12 -8     kateviewinternal.cpp  
 M  +1 -0      kateviewinternal.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1046480
Comment 2 Dominik Haumann 2011-08-08 09:53:02 UTC
Hi Pascal,

this commit is not entirely correct, see http://bugs.kde.org/show_bug.cgi?id=156126

If you search with ctrl+f, the matching text is selected and the cursor is set correctly to the end of the selection. Now close the search, the selection is still there. Now if you type SHIFT+Right to extend the selection, it is invalidated first.

This is because your patch always resets the anchors in ::viewSelectionChanged(). As I see it, this is wrong. If we have a selection, shouldn't the anchors be set accordingly?
Comment 3 Dominik Haumann 2011-08-08 11:55:46 UTC
Git commit 6e93d53c7feacc618d53ca5a79417c08a439c38c by Dominik Haumann.
Committed on 08/08/2011 at 13:54.
Pushed by dhaumann into branch 'master'.

fix selection after search

BUG: 156126
CCBUG: 213693

M  +10   -7    part/view/kateviewinternal.cpp

http://commits.kde.org/kate/6e93d53c7feacc618d53ca5a79417c08a439c38c
Comment 4 Dominik Haumann 2011-08-08 11:56:45 UTC
Git commit 202f5d7fb875bdac41fc778a5f3444db950513ba by Dominik Haumann.
Committed on 08/08/2011 at 13:54.
Pushed by dhaumann into branch 'KDE/4.7'.

fix selection after search

BUG: 156126
CCBUG: 213693

M  +10   -7    part/view/kateviewinternal.cpp

http://commits.kde.org/kate/202f5d7fb875bdac41fc778a5f3444db950513ba