Bug 170582

Summary: Configure Konsole Scroll Wheel Behavior
Product: [Applications] konsole Reporter: Scott Thatcher <thatcher>
Component: generalAssignee: Konsole Developer <konsole-devel>
Status: RESOLVED FIXED    
Severity: wishlist CC: a.samirh78, adaptee, bcmundim, bitshifter, bob.mt.wya, bugs, cpigat242, dogshu, elvstone, kde, mdladwig, nk, phaoost, richlv, robertknight, sweet_f_a
Priority: NOR    
Version: master   
Target Milestone: ---   
Platform: unspecified   
OS: Unspecified   
Latest Commit: Version Fixed In: 18.08
Sentry Crash Report:

Description Scott Thatcher 2008-09-07 07:34:02 UTC
Version:            (using KDE 4.1.1)
Installed from:    Ubuntu Packages

Sometime between Konsole 1.6.6 and Konsole 2.1, the behavior of Konsole was changed so that it sends keyboard up and down events to applications like vim when the scroll wheel is used. In many applications, this behavior is a plus, but I have found that it is not something I like universally.  It would be great to be able to turn this behavior in Konsole 2.1 off so that it functions like previous versions.

Here's the case where it's especially annoying to me: I'm typing in vim on my laptop and my hand brushes the right-hand side of the touch pad, which acts as a scroll wheel.  This behavior is especially bad in vim because the scroll wheel events move the cursor while typing (compare this to the scroll wheel's action in a graphical program, which normally moves the viewing window without moving the cursor). I already use synd to disable the touch pad for a fraction of a second after typing, but my bad habits still lead to this one problem.

Finally, a question. While looking through other bug reports, I saw that it's possible to type

echo -e '\e[?1000h' and 
echo -e '\e[?1000l'

to turn on and off mouse wheel events in some terminals. In Konsole 1.5.6, these commands did indeed enable and disable scrolling in vim (although the scrolling worked slightly differently than in 2.1). However in 2.1, these two commands toggle between the 1.5.6's version of scrolling and 2.1's version of scrolling. Is there another code that will turn off 2.1's scrolling entirely?

Thanks for your work and for your time spent reading this request.
Comment 1 Robert Knight 2008-09-07 13:00:49 UTC
Hi Scott,

Terminal programs can indicate whether they understand mouse actions by sending the '\e?1000h' or '\e?1000l' code (default off).  When the program enables mouse actions the cursor in Konsole changes to a pointer and scroll wheel movement is sent to the terminal using the mouse movement escape codes.  In Vim this is enabled via 'set mouse=a'.  This behavior exists in both 1.6.6 and 2.1.  What is new in 2.1 is that when the program has not enabled mouse actions then Up/Down key presses are sent instead for the benefit of programs like less.  

Sure, I can add an option to disable Up/Down key press sending.
Comment 2 Scott Thatcher 2008-09-11 23:26:57 UTC
Thanks for the speedy reply! I'm especially happy to hear that you may add an option because there seems to be a reported bug with syndaemon that's making it unreliable (at least on my machine) right now. 

st

p.s. This is my second try at adding a comment, and I'm sorry if you get this twice.
Comment 3 Elvis Stansvik 2009-07-13 20:56:49 UTC
Any news on this one? I was trying to find a way to make the following work in Konsole+Vim today:

Scrollwheel ---> Up / Down
Shift+Scrollwheel ---> PgUp / PgDown

But had no luck. I found this bug report though. Do you know if it would be possible to get this behavior somehow Robert? Perhaps you're a Vim user yourself? ;)

I read a bit at :help xterm-mouse-wheel in Vim, but didn't get any wiser.
Comment 4 Robert Knight 2009-07-13 21:56:53 UTC
>  Do you know if it would be possible to get this behavior somehow Robert? 

The scrollwheel already does Up/Down if you have Vim's mouse support turned on.  I expect it would be possible to make shift+scrollwheel send page up/page down commands with some Vim scripting.
Comment 5 Elvis Stansvik 2009-07-13 22:08:10 UTC
Yes, the Scrollwheel --> Up/Down works, even though I don't have mouse support enabled in Vim (don't like it since I like mode-less selection with mouse), though for me it does up/down three lines at a time, but that's OK.

It's the second case I'm trying to get to work; getting Konsole to send PgUp/PgDown on Shift+Scrollwheel. I looked a bit at the Input tab in Konsole's settings, but it seems you can only bind keyboard presses to escape sequences there, not mouse events. Right? It would be cool if I could bind a mouse scroll event in those settings.
Comment 6 Mike 2010-02-09 00:19:14 UTC
This is a severe problem for me.  My hardware is a macbook pro, and the large buttonless trackpad generates scroll events with any accidental touch.  Konsole's behavior turns those into bash history changes, which can occasionally be kind of destructive.  Please add a way to disable this behavior!
Comment 7 Nick Keefen 2010-03-24 23:18:34 UTC
Please add an option to completely disable this behavior. It's a huge problem! I really need to scroll through the console rather than sending up/down events. When i want to send an up/down event, i will - SURPRISE - press up or down :) Mouse scrolling had its own - VERY USEFUL - purpose, and i find replacing its function with a duplicate of a keyboard key rather uncomfortable. As a next step of this "improvement", why don't we make all keyboard buttons input the same symbol? What about 'k'? I'm sure there are people that only need to type  'k' and never need other symbols, and they will find konsole much more useful if the entire keyboard can be used to type their favorite letter.
Comment 8 Jekyll Wu 2011-08-17 02:51:04 UTC
*** Bug 197964 has been marked as a duplicate of this bug. ***
Comment 9 Jekyll Wu 2011-10-14 03:01:51 UTC
Well, the complained new behavior was added to fix bug 153940 .
Comment 10 Jekyll Wu 2011-10-14 03:04:04 UTC
(In reply to comment #9)
> Well, the complained new behavior was added to fix bug 153940 .

Oops, typo. Should be bug #159340.
Comment 11 Graeme Hewson 2013-07-04 10:46:11 UTC
I echo earlier comments. Please can we have an option to disable the behaviour, or else revert the fix to bug  #159340. I don't care about controlling less or vim with the mouse, or using it to go backwards and forwards in the bash history, but I *do* care about accidentally moving the text cursor in vim as I'm pasting some text with the middle button.
Comment 12 richlv 2014-06-20 15:15:42 UTC
for the record, the option i'd like to see is to disable any mouse control completely, only using it for konsole itself. it was slightly annoying before, but now i have one arm damaged, so i can't mess with modifier keys to select in some applications :)
Comment 13 spookypeanut 2014-11-09 08:29:16 UTC
I have just switched to kde from another window manager, and this is really killing me. The inability to turn off trackpad scrolling is making konsole almost unusable to me.
Comment 14 Graeme Hewson 2014-11-09 09:09:47 UTC
There are only 60 votes for this so far...
Comment 15 Bruno Mundim 2015-01-22 07:09:20 UTC
This problem just got worse for me after lenovo introduced this new ultrasensitive trackpad in their thinkpad series. I am using Kubuntu 14.04 and I was wondering if there is already a workaround this issue in the KDE/konsole packed there. I really would like to disable any mouse support in vim, but konsole seems to prevent me from doing that. If not, is there any other terminal on KDE that's reasonably configurable (background and font colors and font size/type) that I could use instead of konsole?

Thanks!
Comment 16 Ruediger Meier 2015-07-19 11:41:50 UTC
(In reply to Graeme Hewson from comment #14)
> There are only 60 votes for this so far...

Because this bug is so ridiculus that usually nobody would even report it. Looks like even the authors of konsole do not use it.

I just removed konsole again  when I first saw this stupid bug in 2009 .... because I had no hope that it would be ever usable ... and I did right ... except that I tried it again today.
Comment 17 bitshifter 2015-08-27 17:11:27 UTC
I have a quick and dirty patch to eliminate the up/down arrow behavior of the scroll wheel.  It would be fantastic if this was a configurable option, but if you are like me and you just can't stand the current behavior this should get you going.

--- a/src/TerminalDisplay.cpp   2013-06-28 13:14:47.138866898 -0400
+++ b/src/TerminalDisplay.cpp   2015-08-27 12:37:53.034042493 -0400
@@ -2410,6 +2410,8 @@
         if (canScroll) {
             _scrollBar->event(ev);
         } else {
+           // NO!!!! Do not send up/down key events.
+#if 0
             // assume that each Up / Down key event will cause the terminal application
             // to scroll by one line.
             //  
@@ -2425,6 +2427,7 @@
 
             for (int i = 0; i < lines; i++)
                 emit keyPressedSignal(&keyEvent);
+#endif
         }   
     } else {
         // terminal program wants notification of mouse activity
Comment 18 Ahmad Samir 2018-04-12 07:43:05 UTC
This should be fixed by this patch:
https://phabricator.kde.org/D12139
Comment 19 Ahmad Samir 2018-04-12 07:59:24 UTC
Support for XTerm Alternate Scroll Mode escape sequences:
https://phabricator.kde.org/D12140

this should help with enabling Alternate Scroll Mode everywhere and disabling it selectively in certain programs, e.g. make vim send the appropriate escape sequence when entering insert mode or something like that.
Comment 20 Kurt Hindenburg 2018-04-13 00:46:10 UTC
Git commit 6b1d799a51e8e8d94d44da06f16f3f039a69b5da by Kurt Hindenburg, on behalf of Ahmad Samir.
Committed on 13/04/2018 at 00:46.
Pushed by hindenburg into branch 'master'.

Add profile property to toggle alternate scrolling

Summary:
Konsole sends up/down key press events to programs running in the shell
if they indicate they are not interested in mouse events. This adds a
profile property to toggle this behaviour.
FIXED-IN: 18.08

Reviewers: #konsole, hindenburg

Reviewed By: #konsole, hindenburg

Subscribers: #konsole

Tags: #konsole

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

M  +9    -0    src/EditProfileDialog.cpp
M  +1    -0    src/EditProfileDialog.h
M  +43   -27   src/EditProfileDialog.ui
M  +2    -0    src/Profile.cpp
M  +13   -0    src/Profile.h
M  +10   -1    src/TerminalDisplay.cpp
M  +13   -0    src/TerminalDisplay.h
M  +2    -0    src/ViewManager.cpp

https://commits.kde.org/konsole/6b1d799a51e8e8d94d44da06f16f3f039a69b5da