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

List:       kde-commits
Subject:    branches/KDE/3.5/kdelibs/kate/part
From:       Matthew Woehlke <mw_triad () users ! sourceforge ! net>
Date:       2007-02-27 18:58:12
Message-ID: 1172602692.474821.21427.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 637773 by mwoehlke:

BUG: 142050

Fix shift+click selection (and make DC-selections persistent again, with further mouse selection anyway)


 M  +37 -10    kateviewinternal.cpp  


--- branches/KDE/3.5/kdelibs/kate/part/kateviewinternal.cpp #637772:637773
@@ -2096,10 +2096,9 @@
         break;
         default:
         {
-          if ( selStartCached.line() < 0 ) // invalid
+          if ( selectAnchor.line() < 0 ) // invalid
             break;
 
-          selectAnchor = selStartCached;
           doSelect = true;
         }
 //         break;
@@ -2670,12 +2669,13 @@
 
         if ( e->state() & Qt::ShiftButton )
         {
-          selStartCached = m_view->selectStart;
-          selEndCached = m_view->selectEnd;
-          updateCursor( selEndCached );
+          if (selectAnchor.line() < 0)
+            selectAnchor = cursor;
         }
         else
+        {
           selStartCached.setLine( -1 ); // invalidate
+        }
 
         if( isTargetSelected( e->pos() ) )
         {
@@ -2686,7 +2686,35 @@
         {
           dragInfo.state = diNone;
 
-          placeCursor( e->pos(), e->state() & ShiftButton );
+          if ( e->state() & Qt::ShiftButton )
+          {
+            placeCursor( e->pos(), true, false );
+            if ( selStartCached.line() >= 0 )
+            {
+              if ( cursor > selEndCached )
+              {
+                m_view->setSelection( selStartCached, cursor );
+                selectAnchor = selStartCached;
+              }
+              else if ( cursor < selStartCached )
+              {
+                m_view->setSelection( cursor, selEndCached );
+                selectAnchor = selEndCached;
+              }
+              else
+              {
+                m_view->setSelection( selStartCached, cursor );
+              }
+            }
+            else
+            {
+              m_view->setSelection( selectAnchor, cursor );
+            }
+          }
+          else
+          {
+            placeCursor( e->pos() );
+          }
 
           scrollX = 0;
           scrollY = 0;
@@ -2712,6 +2740,7 @@
 
       if ( e->state() & Qt::ShiftButton )
       {
+        // FIXME this is totally broken right now
         selStartCached = m_view->selectStart;
         selEndCached = m_view->selectEnd;
         updateSelection( cursor, true );
@@ -2731,8 +2760,7 @@
         m_view->selectWord( cursor );
         if (m_view->hasSelection())
         {
-          selectAnchor = KateTextCursor (m_view->selEndLine(), m_view->selEndCol());
-          selStartCached = m_view->selectStart;
+          selectAnchor = selStartCached = m_view->selectStart;
           selEndCached = m_view->selectEnd;
           updateCursor( selEndCached );
         }
@@ -3256,8 +3284,7 @@
   if (!m_view->hasSelection())
   {
     selectAnchor.setPos (-1, -1);
-    selEndCached = selectAnchor;
-    selStartCached = cursor;
+    selStartCached.setPos (-1, -1);
   }
 }
 
[prev in list] [next in list] [prev in thread] [next in thread] 

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