Mouse going bonkers when remapping <leftmouse>, vim6.3 not vim7

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Mouse going bonkers when remapping <leftmouse>, vim6.3 not vim7

Eric Arnold

These problems happen in the latest 6.3.075 MSWin gvim (as well as the
older 6.3 releases), but not in Vim 7, so I'm suspecting it's not
entirely my fault.


I've got 2 problems happening when I remap <leftmouse> like:

        nnoremap <buffer> <silent> <LeftMouse>
                \<leftmouse>:call RH_select_it( "leftmouse" )<CR>

and the same for <leftdrag> <leftrelease> etc.

1) When I try to move the mouse out of the window that has the mapping,
the cursor jumps back to the lower right, in the GUI scrollbar of the
window.  It persists with this, so you can't actually move the mouse out of
that window with normal mouse movements.  If I use a Vim command to move
to another window, i.e.  ^W^W, then the mouse is normal again.

2) In the times when the mouse doesn't jump back into the scrollbar, it
starts sending a non-stop stream of something (probably <leftmouse>
strings) into the new buffer, as seen flashing in the command window
lower right.  This seems to be more related to mapping the <leftrelease>
key, since I can unmap the <leftmouse> to avoid problem 1), but still have
problem 2 until I unmap <leftrelease>.  This problem doesn't happen reliably.

In neither case do I have to click the mouse to have the problem, which is
odd since the problem is tied to the <leftmouse> key map.  It probably has
to do with the fact that I'm getting a bunch of spurious <leftmouse>
events (usually around 4 to 5) whenever I move the mouse into my window.

It is also related to the speed with which I move the mouse.  If I creep
slowly over the statusline bar between windows, then I don't have the
problem.

The problem(s) don't happen if my mapped window is at the bottom/last, and
I move the mouse down through the command window, and out the side of the
GUI (or my window is at the top, and I move the mouse out the top of GUI).
So, the problem seems to be triggered only when moving the mouse between
[non-cmd] Vim windows.

The mouse shape often gets stuck with the dual up-down arrow, as if I were
trying to resize the window by dragging the status bar, though it resets
if I click in a window.


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Mouse going bonkers when remapping <leftmouse>, vim6.3 not vim7

Eric Arnold

Hmm.  I've found a case where it happens in Vim7, so I'm thinking it's
my bug.  I think my autocommands could have some condition where they
fight for control over which buffer the cursor is in.  If so, it's strange
that Vim7 seems to alleviate the problem, mostly.

If anybody could give me a clue as to why the cursor might be warping into
the scrollbar, that would be helpful.  When I jump between buffers, under
normal circumstances, the cursor ends up in the middle of the text area
where it last was.  I don't have any clues yet for what might be warping into
a non-text area of the window.

--- Eric Arnold <[hidden email]> wrote:

>
> These problems happen in the latest 6.3.075 MSWin gvim (as well as the
> older 6.3 releases), but not in Vim 7, so I'm suspecting it's not
> entirely my fault.
>
>
> I've got 2 problems happening when I remap <leftmouse> like:
>
> nnoremap <buffer> <silent> <LeftMouse>
> \<leftmouse>:call RH_select_it( "leftmouse" )<CR>
>
> and the same for <leftdrag> <leftrelease> etc.
>
> 1) When I try to move the mouse out of the window that has the mapping,
> the cursor jumps back to the lower right, in the GUI scrollbar of the
> window.  It persists with this, so you can't actually move the mouse out of
> that window with normal mouse movements.  If I use a Vim command to move
> to another window, i.e.  ^W^W, then the mouse is normal again.
>
> 2) In the times when the mouse doesn't jump back into the scrollbar, it
> starts sending a non-stop stream of something (probably <leftmouse>
> strings) into the new buffer, as seen flashing in the command window
> lower right.  This seems to be more related to mapping the <leftrelease>
> key, since I can unmap the <leftmouse> to avoid problem 1), but still have
> problem 2 until I unmap <leftrelease>.  This problem doesn't happen reliably.
>
> In neither case do I have to click the mouse to have the problem, which is
> odd since the problem is tied to the <leftmouse> key map.  It probably has
> to do with the fact that I'm getting a bunch of spurious <leftmouse>
> events (usually around 4 to 5) whenever I move the mouse into my window.
>
> It is also related to the speed with which I move the mouse.  If I creep
> slowly over the statusline bar between windows, then I don't have the
> problem.
>
> The problem(s) don't happen if my mapped window is at the bottom/last, and
> I move the mouse down through the command window, and out the side of the
> GUI (or my window is at the top, and I move the mouse out the top of GUI).
> So, the problem seems to be triggered only when moving the mouse between
> [non-cmd] Vim windows.
>
> The mouse shape often gets stuck with the dual up-down arrow, as if I were
> trying to resize the window by dragging the status bar, though it resets
> if I click in a window.
>
>
>

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Mouse going bonkers when remapping <leftmouse>, vim6.3 not vim7

Bram Moolenaar
In reply to this post by Eric Arnold

Eric Arnold wrote:

> These problems happen in the latest 6.3.075 MSWin gvim (as well as the
> older 6.3 releases), but not in Vim 7, so I'm suspecting it's not
> entirely my fault.
>
>
> I've got 2 problems happening when I remap <leftmouse> like:
>
> nnoremap <buffer> <silent> <LeftMouse>
> \<leftmouse>:call RH_select_it( "leftmouse" )<CR>
>
> and the same for <leftdrag> <leftrelease> etc.
>
> 1) When I try to move the mouse out of the window that has the mapping,
> the cursor jumps back to the lower right, in the GUI scrollbar of the
> window.  It persists with this, so you can't actually move the mouse out of
> that window with normal mouse movements.  If I use a Vim command to move
> to another window, i.e.  ^W^W, then the mouse is normal again.
>
> 2) In the times when the mouse doesn't jump back into the scrollbar, it
> starts sending a non-stop stream of something (probably <leftmouse>
> strings) into the new buffer, as seen flashing in the command window
> lower right.  This seems to be more related to mapping the <leftrelease>
> key, since I can unmap the <leftmouse> to avoid problem 1), but still have
> problem 2 until I unmap <leftrelease>.  This problem doesn't happen reliably.
>
> In neither case do I have to click the mouse to have the problem, which is
> odd since the problem is tied to the <leftmouse> key map.  It probably has
> to do with the fact that I'm getting a bunch of spurious <leftmouse>
> events (usually around 4 to 5) whenever I move the mouse into my window.
>
> It is also related to the speed with which I move the mouse.  If I creep
> slowly over the statusline bar between windows, then I don't have the
> problem.
>
> The problem(s) don't happen if my mapped window is at the bottom/last, and
> I move the mouse down through the command window, and out the side of the
> GUI (or my window is at the top, and I move the mouse out the top of GUI).
> So, the problem seems to be triggered only when moving the mouse between
> [non-cmd] Vim windows.
>
> The mouse shape often gets stuck with the dual up-down arrow, as if I were
> trying to resize the window by dragging the status bar, though it resets
> if I click in a window.

You must have 'mousefocus' set.  It generates a mouse click for the
window the mouse pointer is over.  That apparently interferes with your
mappings.  In Vim 7 the code was changed a bit to generate a different
mouse click.

I don't think there is a solution for Vim 6.  Either don't map the mouse
click or don't use 'mousefocus'.

--
The technology involved in making anything invisible is so infinitely
complex that nine hundred and ninety-nine billion, nine hundred and
ninety-nine million, nine hundred and ninety-nine thousand, nine hundred
and ninety-nine times out of a trillion it is much simpler and more
effective just to take the thing away and do without it.
                -- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"

 /// Bram Moolenaar -- [hidden email] -- http://www.Moolenaar.net   \\\
///        Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\              Project leader for A-A-P -- http://www.A-A-P.org        ///
 \\\     Buy LOTR 3 and help AIDS victims -- http://ICCF.nl/lotr.html   ///
Loading...