[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdelibs/kate/part
From:       Christoph Cullmann <cullmann () kde ! org>
Date:       2007-05-05 10:15:10
Message-ID: 1178360110.937676.29698.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 661353 by cullmann:

two fixes:

1. fix assertion/crash on searching pattern with more lines than document
2. don't select not matching parts, confusing ;)



 M  +14 -2     katedocument.cpp  
 M  +2 -0      katesearchbar.cpp  


--- trunk/KDE/kdelibs/kate/part/katedocument.cpp #661352:661353
@@ -27,7 +27,6 @@
 #include "katedialogs.h"
 #include "katehighlight.h"
 #include "kateview.h"
-#include "katesearch.h"
 #include "kateautoindent.h"
 #include "katetextline.h"
 #include "katedocumenthelpers.h"
@@ -1796,7 +1795,12 @@
     int hayLinesZeroIndex = 0;
     KateTextLine::Ptr * hayLinesWindow = new KateTextLine::Ptr[numNeedleLines];
     for (int i = 0; i < numNeedleLines; i++) {
-      hayLinesWindow[i] = m_buffer->plainLine((backwards ? forMax : forMin) + i);
+      KateTextLine::Ptr textLine = m_buffer->plainLine((backwards ? forMax : forMin) \
+ i); +      
+      if (!textLine)
+        return KTextEditor::Range::invalid();
+    
+      hayLinesWindow[i] = textLine;
       kDebug() << "searchText | hayLinesWindow[" << i << "] = \"" << \
hayLinesWindow[i]->string() << "\"" << endl;  }
 
@@ -1951,6 +1955,10 @@
     if (lineCount > line) // TODO
     {
       KateTextLine::Ptr textLine = m_buffer->plainLine(line);
+      
+      if (!textLine)
+        return KTextEditor::Range::invalid();
+      
       QString text = textLine->string();
       const int lineLen = text.length() - col;
       wholeDocument.append(text.right(lineLen));
@@ -1961,6 +1969,10 @@
     for (int i = line + 1; i < lineCount; i++)
     {
       KateTextLine::Ptr textLine = m_buffer->plainLine(i);
+      
+      if (!textLine)
+        return KTextEditor::Range::invalid();
+      
       QString text = textLine->string();
       wholeDocument.append(sep);
       wholeDocument.append(text);
--- trunk/KDE/kdelibs/kate/part/katesearchbar.cpp #661352:661353
@@ -461,11 +461,13 @@
 
     if ( d->expressionEdit->status() == KateSearchBarEdit::NotFound)
     {
+#if 0 // this hurts usability, if you try multiline search but get selected on \
typing the \ for test1\n for example...  // nothing found, so select the non-matching \
                part of the text
         if ( d->expressionEdit->text().startsWith( \
                m_view->document()->text(d->lastMatch) ) )
             d->expressionEdit->setSelection( d->lastMatch.columnWidth(), \
d->expressionEdit->text().length() );  else
             d->expressionEdit->selectAll();
+#endif
     }
 
 }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic