Re: [PATCH] input: scroll on mousewheel instead of moving cursor
Andy Koppe <[email protected]>
| Newsgroups | gmane.editors.nano.devel |
|---|---|
| Message-ID | <[email protected]> |
On 21/02/2024 15:14, Benno Schulenberg wrote: > Op 18-09-2023 om 22:52 schreef Andy Koppe: >> On 18/09/2023 12:22, Benno Schulenberg wrote: >>> Which other terminal editors have a mouse mode? How do I activate it >>> (so that I can see for myself how it behaves there)? >> >> vim: Put ':set mouse=a' into ~/.vimrc (or enter it in command mode). >> >> joe: Invoke with 'joe -mouse'. (Note single dash.) >> >> le: Mouse mode enabled by default. >> >> mcedit: Mouse mode enabled by default. > > Finally I took the time to look at this. > > And I must admit that I like the scrolling behavior of those > editors (when mouse mode is enabled) better. > > So... I'm going to accept the patch. Great, thank you very much! On a closely related note, the 'mintty' terminal used by default in Cygwin, MSYS and Git for Windows has meanwhile gained an "Alt-modified mousewheel mode", which allows for the same mousewheel scrolling behaviour without enabling full xterm mouse mode, so that selecting and copying text still works as usual. When in Alt-modified mousewheel mode, the terminal sends Alt+Up/Down keycodes instead of plain Up/Down for the mousewheel. The mode is ignored when in xterm mouse mode, and it's controlled by escape sequences: - Enable: echo $'\e[?7765h' - Disable: echo $'\e[?7765l' Those can be used to implement a nano wrapper that enables the mode while nano is running. Alternatively, the mode could be enabled once from a shell startup script, in which case other applications that one cares about also need to be taught the Alt+Up/Down keycodes. For example, for 'less', in ~/.lesskey: \e[1;3A back-line \e[1;3B forw-line > One thing I noticed: with one bump of the scrollwheel, > mcedit scrolls two lines, vim three, and joe four -- when > on a real xterm. Yep, it's up to each editor to interpret the button 4 and 5 presses that terminals in xterm mouse mode send for mousewheel events. I think nano and vim have it right with three lines per wheel bump, as that's the default in GUIs. > Strangely, when on an Xfce Terminal, each > editor scrolls double the amount: mcedit four, vim six, and > joe eight lines. Those strides I find too large. Strange indeed. Maybe there's something in the Xfce or terminal settings somewhere that causes it to send two button 4/5 presses per wheel bump. Kind regards, Andy