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

List:       kwrite-devel
Subject:    branches/KDE/3.5/kdelibs/kate/part
From:       Dominik Haumann <dhdev () gmx ! de>
Date:       2006-11-24 12:02:34
Message-ID: 1164369754.586240.5263.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 607385 by dhaumann:

The view's selection selectStart and selectEnd are KateSuperCursors meaning
that they have super-cow power. They are updated *automatically* when text
is inserted or removed. A KateSuperCursor inserts itself into the document's
super cursor list. In KateDocument::editRemove/InsertText there is a loop
over all super cursors to keep them in sync.

The 'un/comment' functions tried to adapt the super cursors themselves,
although they were already updated. This resulted in negative columns, which
somewhere wrapped around in a uint-conversion, which then set an insane
selection, moo. This fixes the crash reported in bug #137555.

Review and testing welcome! ;)

CCMAIL:kwrite-devel@kde.org
BUG:137555


 M  +2 -14     katedocument.cpp  


--- branches/KDE/3.5/kdelibs/kate/part/katedocument.cpp #607384:607385
@@ -3671,10 +3671,7 @@
     removeText (sl, sc, sl, sc + startCommentLen);
 
     editEnd ();
-
-    // Set the new selection
-    ec -= endCommentLen + ( (el == sl) ? startCommentLen : 0 );
-    view->setSelection(sl, sc, el, ec + 1);
+    // set new selection not necessary, as the selection cursors are KateSuperCursors
   }
 
   return remove;
@@ -3737,16 +3734,7 @@
   }
 
   editEnd();
-
-  if (removed)
-  {
-    // Set the new selection
-    KateDocCursor end (view->selEnd());
-    end.setCol(view->selEndCol() - ((el == view->selEndLine()) ? removeLength : 0) );
-
-    setSelection(view->selStartLine(), view->selStartCol(), end.line(), end.col());
-  }
-
+  // updating selection already done by the KateSuperCursors
   return removed;
 }
 
_______________________________________________
KWrite-Devel mailing list
KWrite-Devel@kde.org
https://mail.kde.org/mailman/listinfo/kwrite-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

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