Bug 97140 - find and replaces do not work when block selection is on
Summary: find and replaces do not work when block selection is on
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: general (other bugs)
Version First Reported In: 2.3.2
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Christoph Cullmann
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-01-16 14:11 UTC by Luca Sbordone
Modified: 2005-10-05 18:21 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Luca Sbordone 2005-01-16 14:11:45 UTC
Version:           2.3.2 (using KDE 3.3.2, compiled sources)
Compiler:          gcc version 3.3.2 20031022 (Red Hat Linux 3.3.2-1)
OS:                Linux (i686) release 2.4.22-1.2115.nptl

When block (or box, as you may call it) selection is on, but NOTHING is selected, find and replace do not work, meaning they open their window but do not find any instance of the text you are searching for. If you, instead, select a block of text and search inside the selection, it works. Shortly:
- switch to block selection 
- do a "find" on something you are sure is in the file (but without selecting it)
- kate will say "search string not found".
I would expect it to find the search string no matter which selection mode I'm in. But maybe is a deliberate behaviour of which I don't get the reason... Thanks anyway!
Comment 1 Ryan Dalzell 2005-03-07 16:39:23 UTC
Hi, this bug is still present in 3.4.0 beta2:

Kate 2.4 (using KDE 3.3.92 (beta2))
Comment 2 Christoph Cullmann 2005-03-24 18:34:35 UTC
hmm, in deed :/
could somebody tell me what this does in doSearch() ?


  do {
      if( regExp ) {
        m_re = QRegExp( text, caseSensitive );
        found = doc()->searchText( line, col, m_re,
                                  &foundLine, &foundCol,
                                  &matchLen, backward );
      } else if ( wholeWords ) {
        QRegExp re( "\\b" + text + "\\b", caseSensitive );
        found = doc()->searchText( line, col, re,
                                  &foundLine, &foundCol,
                                  &matchLen, backward );
      } else {
        found = doc()->searchText( line, col, text,
                                  &foundLine, &foundCol,
                                  &matchLen, caseSensitive, backward );
      }

    if ( found && s.flags.selected )
    {
      if ( !s.flags.backward && KateTextCursor( foundLine, foundCol ) >= s.selEnd
        ||  s.flags.backward && KateTextCursor( foundLine, foundCol ) < s.selBegin )
        found = false;
      else if (m_view->blockSelectionMode())
      {
        if ((int)foundCol < s.selEnd.col() && (int)foundCol >= s.selBegin.col())
          break;
      }
    }

    line = foundLine;
    col = foundCol+1;
  }
  while (m_view->blockSelectionMode() && found);

why the while (...blockSele...) stuff?
Comment 3 Mathieu Jobin 2005-08-13 01:46:29 UTC
isn't this a duplicate of the already close bug #66022 ???

Comment 4 Christoph Cullmann 2005-10-05 18:21:02 UTC
SVN commit 467563 by cullmann:

fix one block selection search bug ;)

BUG: 97140


 M  +3 -2      katesearch.cpp  


--- branches/KDE/3.5/kdelibs/kate/part/katesearch.cpp #467562:467563
@@ -596,7 +596,7 @@
         found = false;
       else if (m_view->blockSelectionMode())
       {
-        if ((int)foundCol < s.selEnd.col() && (int)foundCol >= s.selBegin.col())
+        if ((int)foundCol < QMAX(s.selEnd.col(), s.selBegin.col()) && (int)foundCol >= QMIN(s.selEnd.col(), s.selBegin.col()))
           break;
       }
     }
@@ -604,7 +604,8 @@
     line = foundLine;
     col = foundCol+1;
   }
-  while (m_view->blockSelectionMode() && found);
+  while (s.flags.selected && m_view->blockSelectionMode() && found);
+  // in the case we want to search in selection + blockselection we need to loop
 
   if( !found ) return false;