Bug 129853

Summary: Horizontal scrollbar and view not synced, if dynamic and static word wrap are off
Product: [Applications] kate Reporter: Dominik Haumann <dhaumann>
Component: partAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:

Description Dominik Haumann 2006-06-26 17:39:09 UTC
Version:           2.5.3 (using KDE 3.5.3, Gentoo)
Compiler:          gcc version 3.4.5 (Gentoo 3.4.5-r1, ssp-3.4.5-1.0, pie-8.7.9)
OS:                Linux (i686) release 2.6.16-suspend2-r5

Settings: dynamic word wrap and static word wrap off

1. Empty buffer
2. add a long line, so that you have to scroll horizontally.
3. go to end of line.
4. press SHIFT and go to the left, until you are at about column 80
5. press del

Now you can see that the scrollbar is disabled again (as the text fits into the view width), but the text is out of the view. A realignment of the text is missing.
Comment 1 Andreas Kling 2006-06-26 17:55:59 UTC
SVN commit 555177 by kling:

Relocate view to leftmost column when disabling the horizontal scrollbar.

BUG: 129853


 M  +6 -2      kateviewinternal.cpp  
 M  +0 -1      kateviewinternal.h  


--- branches/KDE/3.5/kdelibs/kate/part/kateviewinternal.cpp #555176:555177
@@ -141,7 +141,6 @@
 
   m_columnScroll->setTracking(true);
   m_startX = 0;
-  m_oldStartX = 0;
 
   connect( m_columnScroll, SIGNAL( valueChanged (int) ),
            this, SLOT( scrollColumns (int) ) );
@@ -455,7 +454,6 @@
     x = 0;
 
   int dx = m_startX - x;
-  m_oldStartX = m_startX;
   m_startX = x;
 
   if (QABS(dx) < width())
@@ -689,6 +687,12 @@
     if (max < 0)
       max = 0;
 
+    // if we lose the ability to scroll horizontally, move view to the far-left
+    if (max == 0)
+    {
+      m_startX = 0;
+    }
+
     // disable scrollbar
     m_columnScroll->setDisabled (max == 0);
 
--- branches/KDE/3.5/kdelibs/kate/part/kateviewinternal.h #555176:555177
@@ -268,7 +268,6 @@
     //
     QScrollBar *m_columnScroll;
     int m_startX;
-    int m_oldStartX;
 
     // has selection changed while your mouse or shift key is pressed
     bool m_selChangedByUser;
Comment 2 Andreas Kling 2006-06-26 18:01:00 UTC
SVN commit 555181 by kling:

Forward-port of SVN commit 555177 by kling: 
 
Relocate view to leftmost column when disabling the horizontal scrollbar. 
   
CCBUG: 129853 


 M  +6 -2      kateviewinternal.cpp  
 M  +0 -1      kateviewinternal.h  


--- trunk/KDE/kdelibs/kate/part/kateviewinternal.cpp #555180:555181
@@ -159,7 +159,6 @@
 
   m_columnScroll->setTracking(true);
   m_startX = 0;
-  m_oldStartX = 0;
 
   connect(m_columnScroll, SIGNAL(valueChanged(int)), SLOT(scrollColumns(int)));
 
@@ -505,7 +504,6 @@
     x = 0;
 
   int dx = m_startX - x;
-  m_oldStartX = m_startX;
   m_startX = x;
 
   if (qAbs(dx) < width())
@@ -553,6 +551,12 @@
     if (max < 0)
       max = 0;
 
+    // if we lose the ability to scroll horizontally, move view to the far-left
+    if (max == 0)
+    {
+      m_startX = 0;
+    }
+
     // disable scrollbar
     m_columnScroll->setDisabled (max == 0);
 
--- trunk/KDE/kdelibs/kate/part/kateviewinternal.h #555180:555181
@@ -294,7 +294,6 @@
     //
     QScrollBar *m_columnScroll;
     int m_startX;
-    int m_oldStartX;
 
     // has selection changed while your mouse or shift key is pressed
     bool m_selChangedByUser;