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

List:       kde-commits
Subject:    branches/KDE/3.4/kdelibs/khtml
From:       Luboš Luňák <l.lunak () kde ! org>
Date:       2005-05-13 13:08:34
Message-ID: 1115989714.352327.25623.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 413143 by lunakl:

Backport avoiding unneccessary horizontal scrolling while searching.



 M  +8 -2      branches/KDE/3.4/kdelibs/khtml/khtml_part.cpp  


--- branches/KDE/3.4/kdelibs/khtml/khtml_part.cpp #413142:413143
@@ -3162,8 +3162,14 @@
           ->caretPos( d->m_startOffset, false, x, y, dummy, dummy ); // more precise than posOfChar
         //kdDebug(6050) << "topleft: " << x << "," << y << endl;
         if ( x != -1 || y != -1 )
-        {
-          d->m_view->setContentsPos(x-50, y-50);
+        {        
+          int gox = d->m_view->contentsX();
+          if (x+50 > d->m_view->contentsX() + d->m_view->visibleWidth())
+              gox = x - d->m_view->visibleWidth() + 50;
+          if (x-10 < d->m_view->contentsX()) 
+              gox = x - d->m_view->visibleWidth() - 10;
+          if (gox < 0) gox = 0;
+          d->m_view->setContentsPos(gox, y-50);
           highlightedRect.setTopLeft( d->m_view->mapToGlobal(QPoint(x, y)) );
         }
       }
[prev in list] [next in list] [prev in thread] [next in thread] 

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