Bug 106571

Summary: backward text selection doesn't trigger horizontal scroll
Product: [Applications] kate Reporter: benjamin isant <benjamin>
Component: partAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED FIXED    
Severity: major    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: just give a look at it
this file allows you to experience the bug
fix for the bug

Description benjamin isant 2005-05-31 23:03:25 UTC
Version:           4.4 (using KDE 3.4.1%2C%2520Arch%2520Linux)
Compiler:          gcc%2520version%25203.4.3
OS:                Linux%2520%28i686%29%2520release%25202.6.11.10-ARCH

when dynamic word wrap is unactivated, selection on a long line forward, trigger horizontal scroll toward right ..

But when trying to do a selection backward (toward left), horizontal scroll does not trigger, forcing user to stop selecting and move the scrollbar manually

reproducible at any time on my machine
I send you a picture to compensate my poor English.

thanks for the hard work.
I use kwrite daily

benjamin
Comment 1 benjamin isant 2005-05-31 23:04:50 UTC
Created attachment 11277 [details]
just give a look at it
Comment 2 Christoph Cullmann 2005-10-29 14:33:34 UTC
Should be considered major, anyone fun to look at this?
Comment 3 Hamish Rodda 2005-10-30 13:32:28 UTC
Doesn't seem to happen in kde 3.5

Ugh, means I need a kde 3.4 checkout :(
Comment 4 Christoph Cullmann 2005-10-30 15:38:32 UTC
That happens for me even with current 3.5 branch
just create a long line, if you select to the right, everything fine, the view scrolls, but if you select to the left, the view doesn't scroll back :(
Comment 5 Anders Lund 2006-01-01 20:44:49 UTC
Any news?
I can't confirm still, with up to date kde 3.5 branch.
Comment 6 Dominik Huber 2006-01-02 18:14:56 UTC
I can confirm the bug with up to date kde 3.5 branch.

But only whe using the _mouse_ to select to the left, with the keyboard (shift + arrow left) it works.
Comment 7 benjamin isant 2006-01-02 20:22:32 UTC
I had the problem with kde 3.4;
However, using the same distrib (archlinux), I don't experience the bug anymore with kde 3.5
Comment 8 Anders Lund 2006-01-02 20:39:32 UTC
I conclude that this have gone by now. It works using both keyboard and mouse.
Comment 9 benjamin isant 2006-01-03 22:04:34 UTC
Correction: I still experience the bug with files containing some Chinese characters.

Backward selection with the mouse works fine with western letters and stop as soon as it touches a Chinese character (utf-8 encoding)

I pass along a test file

Comment 10 benjamin isant 2006-01-03 22:09:34 UTC
Created attachment 14125 [details]
this file allows you to experience the bug

This file may (hopefully(?)) allow you to experience the bug with kde 3.5
branch

This file is UFT-8 encoded and contain some simplified Chinese characters
Comment 11 Anders Lund 2006-01-03 22:31:16 UTC
On Tuesday 03 January 2006 22:09, benjamin isant wrote:
> This file may (hopefully(?)) allow you to experience the bug with kde 3.5
> branch


Yes, selecting by mouse stops at the special characters (which btw can't be 
rendered using bitstream vera sans mono). Scrolling using mouse works fine 
though.

Thanks for this information.

-anders
Comment 12 Dominik Haumann 2006-07-05 23:41:51 UTC
Created attachment 16904 [details]
fix for the bug

This patch fixes the issue. The problem is, that m_startX isn't adapted
anywhere, so the view does not move to the left. The corresponding line is
      m_startX = QMAX(0, m_startX+(mouseX-d)/d);

Explanation: mouseX is < 0
The expression m_startX + mouseX/d does not work in 100% of the cases, because
if you maximize kwrite you cannot move the mouse further to the left, so that
mouseX/d=0. Thus, I added the offset -d, which results in (mouseX-d)/d.

I'm not sure, whether this is really the correct fix, so kate devs, please
review. For me, the fix works perfectly ;)
Comment 13 Dominik Haumann 2006-07-06 11:23:12 UTC
SVN commit 558895 by dhaumann:

fix: backward text selection doesn't trigger horizontal scroll
Please test :)

This fix is more correct than the patch attached in bug #106571 in comment #12.
Note: In trunk, this bug does not exist.

BUG: 106571


 M  +1 -1      kateviewinternal.cpp  


--- branches/KDE/3.5/kdelibs/kate/part/kateviewinternal.cpp #558894:558895
@@ -2365,7 +2365,7 @@
 
   KateTextCursor c(realLine, 0);
 
-  int x = QMIN(QMAX(0, p.x() - thisRange.xOffset()), lineMaxCursorX(thisRange) - thisRange.startX);
+  int x = QMIN(QMAX(-m_startX, p.x() - thisRange.xOffset()), lineMaxCursorX(thisRange) - thisRange.startX);
 
   m_view->renderer()->textWidth( c, startX() + x, startCol);