Bug 122101 - Text selection when searching not properly updating selection start/end position
Summary: Text selection when searching not properly updating selection start/end position
Alias: None
Product: kate
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Gentoo Packages Linux
: NOR normal with 1 vote (vote)
Target Milestone: ---
Assignee: KWrite Developers
Depends on:
Reported: 2006-02-16 14:45 UTC by Stuart Bingë
Modified: 2008-01-18 18:28 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Note You need to log in before you can comment on or make changes to this bug.
Description Stuart Bingë 2006-02-16 14:45:19 UTC
Version:            (using KDE KDE 3.5.1)
Installed from:    Gentoo Packages
Compiler:          g++ (GCC) 3.4.5 (Gentoo 3.4.5, ssp-3.4.5-1.0, pie-8.7.9) 
OS:                Linux

When searching for a text string (in normal/non-block mode), and when that string is matched in the current document, the match is selected. This selection, however, appears to have invalid start/end positions - even though the match string looks to be properly highlighted and copy/cut works as expected with the string, there is a problem when trying to extend or contract the selection using shift + cursor keys.

When trying to extend the selection using these keys the start of the selection block jumps from the start of the current match string to what seems to be the end of the prior selection block, meaning your current selection includes all the text between the previous match selection end and the new match selection end.

The "previous selection end" to which the start position jumps only seems to change when you move the cursor using the arrow keys, without holding shift - if you do hold shift and modify the selection block using the arrow keys, hit find again, modify the selection, etc..., the start of the selection block always jumps to the same place.
Comment 1 Andreas Kling 2006-07-10 00:24:26 UTC
SVN commit 560302 by kling:

Synchronize the "cached" selection when exposing a search match.
This makes it possible to modify the new selection.

BUG: 122101

 M  +1 -0      katesearch.cpp  
 M  +6 -0      kateview.cpp  
 M  +2 -0      kateview.h  

--- branches/KDE/3.5/kdelibs/kate/part/katesearch.cpp #560301:560302
@@ -736,6 +736,7 @@
   view()->setCursorPositionInternal ( cursor.line(), cursor.col() + slen, 1 );
   view()->setSelection( cursor.line(), cursor.col(), cursor.line(), cursor.col() + slen );
+  view()->syncSelectionCache();
 //END KateSearch
--- branches/KDE/3.5/kdelibs/kate/part/kateview.cpp #560301:560302
@@ -1373,6 +1373,12 @@
   return setSelection( KateTextCursor(startLine, startCol), KateTextCursor(endLine, endCol) );
+void KateView::syncSelectionCache()
+  m_viewInternal->selStartCached = selectStart;
+  m_viewInternal->selEndCached = selectEnd;
 bool KateView::clearSelection()
   return clearSelection(true);
--- branches/KDE/3.5/kdelibs/kate/part/kateview.h #560301:560302
@@ -238,6 +238,8 @@
     void selectLine(   const KateTextCursor& cursor );
     void selectLength( const KateTextCursor& cursor, int length );
+    void syncSelectionCache();
   // KTextEditor::BlockSelectionInterface stuff
Comment 2 Maciej Pilichowski 2007-10-06 20:54:13 UTC
Bug is still there, KDE 3.5.7. Please reopen.