Bug 408874 - DragScroll much faster (too fast) downward compared to upward
Summary: DragScroll much faster (too fast) downward compared to upward
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: part (show other bugs)
Version: 18.08.0
Platform: Debian stable Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-06-18 15:19 UTC by Axel Kittenberger
Modified: 2019-06-24 20:14 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Axel Kittenberger 2019-06-18 15:19:32 UTC
SUMMARY 


STEPS TO REPRODUCE
1. When selecting text and dragging over the edge, auto scrolling starts
2. Notice this is way faster down than up.
3. Notice this is likely way faster than you'd like to

ADDITIONAL INFORMATION

I worked mostly with an old version (14.3) and with kile, but I just tested in a VM with debian buster having 18.8.0 the same bug is still there

In the old version I seem to have fixed it with following patch. There are two issues, one is in KateViewInternal::scrollTimeout() itself, where placeCursor() and scrollLines() interfere with each other on the startLine. And the other is in KateViewInternal::mouseMoveEvent() where in case of scrollTimouts when dragging the mouse and moving the mouse around, the events double an again placeCursor() messes around with startLine. In my "fix" I just disabled placing the cursor when scrollTimeouts are about to arrive, as this will be place the cursor (with correct scrolling speed). 

-----------------------
diff -ru kate-4.14.3/part/view/kateviewinternal.cpp kate-4.14.3-orig/part/view/kateviewinternal.cpp
--- kate-4.14.3/part/view/kateviewinternal.cpp  2019-06-18 17:05:47.507032294 +0200
+++ kate-4.14.3-orig/part/view/kateviewinternal.cpp 2014-10-26 21:17:55.000000000 +0100
@@ -2864,7 +2864,7 @@
       m_scrollY = d;
     }
 
-   if( !m_scrollY ) placeCursor( QPoint( m_mouseX, m_mouseY ), true );
+    placeCursor( QPoint( m_mouseX, m_mouseY ), true );
 
   }
   else
@@ -3092,9 +3092,8 @@
 {
   if (m_scrollX || m_scrollY)
   {
-    int scrollTo = startPos().line() + (m_scrollY / (int) renderer()->lineHeight());
+    scrollLines (startPos().line() + (m_scrollY / (int) renderer()->lineHeight()));
     placeCursor( QPoint( m_mouseX, m_mouseY ), true );
-    scrollLines (scrollTo);
   }
 }
-----------------

Sorry it's for the old version where I needed this fixed, but I believe some way or another it's still an up2date bug, probably with some similar fix.

Maybe there is a more elegant solution to keep better track of startLine while auto-scrolling.
Comment 1 Axel Kittenberger 2019-06-18 15:56:11 UTC
PS: sorry my above patch proposal got out to be reversed, this is in the right direction:

diff -ru kate-4.14.3-orig/part/view/kateviewinternal.cpp kate-4.14.3/part/view/kateviewinternal.cpp
--- kate-4.14.3-orig/part/view/kateviewinternal.cpp 2014-10-26 21:17:55.000000000 +0100
+++ kate-4.14.3/part/view/kateviewinternal.cpp  2019-06-18 17:05:47.507032294 +0200
@@ -2864,7 +2864,7 @@
       m_scrollY = d;
     }
 
-    placeCursor( QPoint( m_mouseX, m_mouseY ), true );
+    if( !m_scrollY ) placeCursor( QPoint( m_mouseX, m_mouseY ), true );
 
   }
   else
@@ -3092,8 +3092,9 @@
 {
   if (m_scrollX || m_scrollY)
   {
-    scrollLines (startPos().line() + (m_scrollY / (int) renderer()->lineHeight()));
+    int scrollTo = startPos().line() + (m_scrollY / (int) renderer()->lineHeight());
     placeCursor( QPoint( m_mouseX, m_mouseY ), true );
+    scrollLines (scrollTo);
   }
 }
Comment 2 Nate Graham 2019-06-18 17:54:00 UTC
Thanks for the patch! Can you submit it using https://phabricator.kde.org/differential/diff/create/?

Full documentation is available at https://community.kde.org/Infrastructure/Phabricator
Comment 3 Axel Kittenberger 2019-06-24 12:00:19 UTC
OK, there I uplaoded it. https://phabricator.kde.org/D22071
Comment 4 Nate Graham 2019-06-24 12:11:49 UTC
Thanks!
Comment 5 Christoph Cullmann 2019-06-24 20:14:52 UTC
Git commit 4f4d1ad9b78999671c4944e013ea4f103d8ce86c by Christoph Cullmann, on behalf of Axel Kittenberger.
Committed on 24/06/2019 at 20:14.
Pushed by cullmann into branch 'master'.

fix autoscrolling down speed

Differential Revision: https://phabricator.kde.org/D22071

M  +5    -2    src/view/kateviewinternal.cpp

https://commits.kde.org/ktexteditor/4f4d1ad9b78999671c4944e013ea4f103d8ce86c