Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 761787 - x11-terms/rxvt-unicode: patch to add sgr (1006) mouse mode support
Summary: x11-terms/rxvt-unicode: patch to add sgr (1006) mouse mode support
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal enhancement (vote)
Assignee: Marek Szuba
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2020-12-26 17:43 UTC by Oscar Linderoth
Modified: 2020-12-31 14:52 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
patch that adds sgr 1006 mouse mode support to urxvt (rxvt-unicode-9.22-sgr-mouse-mode.patch,2.95 KB, patch)
2020-12-26 17:43 UTC, Oscar Linderoth
Details | Diff
ebuilt that applies the patch (rxvt-unicode-9.22-r7.ebuild,2.72 KB, text/plain)
2020-12-26 17:44 UTC, Oscar Linderoth
Details
Take 2: patch for sgrmouse flag (rxvt-unicode-9.22-sgr-mouse-mode-flag.patch,5.48 KB, patch)
2020-12-28 19:42 UTC, Oscar Linderoth
Details | Diff
Take 2: ebuild with sgrmouse flag (rxvt-unicode-9.22-r7.ebuild,2.76 KB, text/plain)
2020-12-28 19:42 UTC, Oscar Linderoth
Details
Take 2: metadata.xml for sgrmouse use flag (metadata.xml,1.65 KB, text/xml)
2020-12-28 19:43 UTC, Oscar Linderoth
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Oscar Linderoth 2020-12-26 17:43:56 UTC
Created attachment 679542 [details, diff]
patch that adds sgr 1006 mouse mode support to urxvt

Hi!

This patch adds sgr 1006 mouse mode support to urxvt. This seems to be the only way to get the mouse to work past column 223 when running urxvt + screen/tmux + vim. Vim supports both ttymouse=urxvt (1015) and ttymouse=sgr, but screen and tmux support only the more widely available sgr mode.

https://savannah.gnu.org/bugs/?37206


I found it over at Arch's AUR and adapted it to apply cleanly on 9.22.

https://aur.archlinux.org/cgit/aur.git/tree/sgr-mouse-mode.patch?h=rxvt-unicode-cvs-patched-wideglyphs
Comment 1 Oscar Linderoth 2020-12-26 17:44:33 UTC
Created attachment 679545 [details]
ebuilt that applies the patch
Comment 2 Marek Szuba archtester gentoo-dev 2020-12-27 22:54:56 UTC
Could you extend this patch so that this feature can be either enabled or disabled at build time, please? It is generally frowned upon in Gentoo to have patches applied conditionally, and I will definitely not enable a third-party feature for everyone.
Comment 3 Oscar Linderoth 2020-12-28 19:40:23 UTC
Hi Marek,

Thanks for your quick reply! Fair enough, that makes a lot of sense.

I'm mainly a Python developer, so this autoconf stuff is a bit new to me, but I took a stab at it. Apologies if I made some obvious mistake.

I re-wrote parts of the code as preprocessor conditionals with a new macro ENABLE_SGRMOUSE with its own autoconf flag --enable-sgrmouse. Then I added "sgrmouse" as a use flag in the ebuild and in the package metadata.xml.

Does that sound like an acceptable solution?

I'll attach the new files below.

I tested building with/without sgrmouse and then tested all mouse modes with vttest (https://invisible-island.net/vttest/) and in vim. Everything works as expected: SGR only works with sgrmouse and all the other modes work in both cases. (To make vim enable ttymouse=sgr on urxvt you need to fool it with e.g. TERM=screen.)

It also correctly reports whether it was built with sgrmouse support now:

$ urxvt -help
rxvt-unicode (urxvt) v9.22 - released: 2016-01-23
options: perl,xft,styles,combining,blink,iso14755,encodings=eu+vn+jp+jp-ext+kr+zh+zh-ext,fade,transparent,tint,XIM,frills,sgrmouse,selectionscrolling,wheel,slipwheel,cursorBlink,pointerBlank,scrollbars=plain+rxvt+NeXT+xterm
[...]


Best regards,
Oscar
Comment 4 Oscar Linderoth 2020-12-28 19:42:16 UTC
Created attachment 680104 [details, diff]
Take 2: patch for sgrmouse flag
Comment 5 Oscar Linderoth 2020-12-28 19:42:51 UTC
Created attachment 680107 [details]
Take 2: ebuild with sgrmouse flag
Comment 6 Oscar Linderoth 2020-12-28 19:43:24 UTC
Created attachment 680113 [details]
Take 2: metadata.xml for sgrmouse use flag
Comment 7 Larry the Git Cow gentoo-dev 2020-12-31 14:52:57 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=01fa0495e04575b2295bfb0afe2164caba7511e4

commit 01fa0495e04575b2295bfb0afe2164caba7511e4
Author:     Marek Szuba <marecki@gentoo.org>
AuthorDate: 2020-12-31 14:45:19 +0000
Commit:     Marek Szuba <marecki@gentoo.org>
CommitDate: 2020-12-31 14:52:49 +0000

    x11-terms/rxvt-unicode: Optionally support xterm SGR 1006 mouse extension
    
    Needed in order for mouse tracking to work properly in large terminals,
    for all applications which do not the urxvt 1015 extension (and not many
    do). Relies on a third-party patch (ported from AUR, and extended to make
    this feature dependent on a build-time flag, by the bug reporter), as
    upstream allegedly refused to implement this.
    
    Suggested-by: Oscar L <oscar_bugs@nym.hush.com>
    Closes: https://bugs.gentoo.org/761787
    Signed-off-by: Marek Szuba <marecki@gentoo.org>

 .../rxvt-unicode-9.22-sgr-mouse-mode-flag.patch    | 165 +++++++++++++++++++++
 x11-terms/rxvt-unicode/metadata.xml                |   3 +
 x11-terms/rxvt-unicode/rxvt-unicode-9.22-r7.ebuild | 112 ++++++++++++++
 3 files changed, 280 insertions(+)