Saturday, January 21, 2012

Re: Fwd: Mouse reporting and new standards

Hi Bram,

I think all your technical questions are answered in the first comment of http://www.midnight-commander.org/ticket/2662 -- please see that, and of course feel free to ask if you have any more questions.

thanks,
egmont


On Sat, Jan 21, 2012 at 14:20, Bram Moolenaar <Bram@moolenaar.net> wrote:

Egmont wrote:

> Hi Bram, George, others...
>
> A lot happened since you had this discussion about a year ago.  Vim has
> added support for the urxvt mouse extension, and so did a couple of terminal
> emulators (xterm, vte/gnome-terminal, George's iterm2, urxvt of course;
> konsole is hopefully the next to join the line).
>
> Unfortunately, this feature (or I'd rather call it bugfix) won't be
> available for many users. First, vim has to be configured
> --with-features=big which is not the default, so many distributions or users
> might miss it. Second, vimrc needs to be updated to contain :set
> ttymouse=urxvt, yet again something that's easy to miss. Third, this
> ttymouse=urxvt setting is brittle; it breaks mouse support if your terminal
> doesn't support the extension, so your vimrc becomes unportable across
> various terminal emulators.
>
> Bram, you said you were in favor of automatic detection. Luckily, the urxvt
> extension allows this. The escape that switches to the new mode is
> recognized by terminals that support it, and is ignored by others. I'm not
> aware of any terminal that would misbehave seeing such an unrecognized
> escape. The old and new style mouse coordinates, as reported by the
> terminal, are distinguishable from each other, so an application doesn't
> need to know whether the terminal supports the extension: it just asks the
> terminal to switch it on, and then receives mouse events in either the old
> or the new format.

Yes, I like this to work automatically.  Please fill in the details:
- What is the code to switch it on?
- What is the format of mouse clicks when it is on and off (like urxvt
 and xterm I suppose)
- How do we recognize both at the same time?

> In order for clicks beyond 223 to become a mainstream fix that works for all
> users, rather than an extra bonus feature for a subset of power users, I
> recommend doing the following:
>
> - Make the feature compile by default whenever mouse support is compiled;
> - Get rid of ttymouse=urxvt, put the feature of urxvt mouse coordinate
> parsing into ttymouse=xterm;
> - In case of ttymouse=xterm, make vim recognize both the old standard and
> the new urxvt coordinates at the same time.

I would like to see how this works.

> This way all vim users who have mouse support would automatically get
> support for extended coordinates, they wouldn't have to modify their vimrc,
> and the feature would be autodetected: it would work on terminals that
> support it, while mouse would still work up to col/row 223 on terminals that
> don't support the extension.
>
> The same idea is already implemented in Midnight Commander 4.8.1, for
> further technical discussions see http://midnight-commander.org/ticket/2662
> .
>
> What do you guys think? Should we make these changes so that this fix works
> out of the box?

Sounds good, but we need the details to decide if it's going to work
reliably.

BTW: Looking at the urxvt mouse detection code, it looks like there is
danger of getting stuck on a broken input sequence, when a semicolon is
missing it does "return -1", which means it gets more characters.  If
the semicolon is any other non-digit character we loop forever.

--
Mrs Abbott: I'm a paediatrician.
    Basil: Feet?
Mrs Abbott: Children.
    Sybil: Oh, Basil!
    Basil: Well, children have feet, don't they? That's how they move
           around, my dear. You must take a look next time, it's most
           interesting.                               (Fawlty Towers)

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: