Hi,
I've been trying to get mouse scrolling working for applications using
alternate screen (less, man, ...). On alternate screen, urxvt only
allows to scroll in the history buffer.
This behavior is different from VTE based terminals, which for
alternate screen simulate key-presses instead of scrolling the history
buffer. I like this behavior and I would like to replicate it inside
urxvt.
I've found a plugin called 'vtwheel' [1] which is supposed to replicate
the behaviour. It works for 'man' or 'less', but it changes the
behavior of scrolling inside 'vim'. For vim, it scrolls the screen but
it also changes the cursor position, which I don't like.
Looking at the source code of VTE, I've found out that key-press
simulation for alternate screen is disabled when the mouse reporting is
turned on. So for other programs like 'man' or 'less', that
don't use mouse-reporting, scrolling is done using simulated key
presses. Conversely, vim uses mouse reporting, so scrolling is
therefore unchanged and handled by vim itself.
So in order to have the same behavior in urxvt, the simplest option
would be to change vtwheel to check for mouse reporting and not to do
key-press simulation when it's turned on, but as far as I know, mouse
reporting is not exposed to the perl extensions.
Therefore, I'm sending this patch to expose the state of mouse-reporting
to the perl extensions.
[1] https://aur.archlinux.org/cgit/aur.git/plain/vtwheel?h=urxvt-vtwheel
Regards,
Rastislav
--- rxvtperl.xs.orig 2017-06-19 22:47:42.001157061 +0100
+++ rxvtperl.xs 2017-06-19 22:47:23.431767475 +0100
@@ -1422,6 +1422,7 @@
ModNumLockMask = 2
current_screen = 3
hidden_cursor = 4
+ mouse_report = 5
CODE:
switch (ix)
{
@@ -1432,6 +1433,7 @@
#ifdef CURSOR_BLINK
case 4: RETVAL = THIS->hidden_cursor; break;
#endif
+ case 5: RETVAL = !!(THIS->priv_modes & PrivMode_mouse_report); break;
}
OUTPUT:
RETVAL
--- urxvt.pm.orig 2017-06-19 23:01:12.172080538 +0100
+++ urxvt.pm 2017-06-19 23:01:01.613884350 +0100
@@ -1693,6 +1693,10 @@
Returns whether the cursor is currently hidden or not.
+=item $mouse_reporting = $term->mouse_report
+
+Returns whether the mouse reporting is currently active or not.
+
=item $view_start = $term->view_start ([$newvalue])
Returns the row number of the topmost displayed line. Maximum value is
_______________________________________________
rxvt-unicode mailing list
[email protected]
http://lists.schmorp.de/mailman/listinfo/rxvt-unicode