Hi

Compiling Vim-7.2.411 with gcc-4.5 using -Wlogical-op,
I see this compilation warning which is a real bug in Vim:

normal.c:6526:5: warning: logical 'and' of mutually exclusive tests is
always false

6521 #ifdef FEAT_MOUSE
6522     /*
6523      * [ or ] followed by a middle mouse click: put selected text with
6524      * indent adjustment.  Any other button just does as usual.
6525      */
6526     else if (cap->nchar >= K_LEFTMOUSE && cap->nchar <= K_RIGHTRELEASE)
6527     {
6528         (void)do_mouse(cap->oap, cap->nchar,
6529                        (cap->cmdchar == ']') ? FORWARD : BACKWARD,
6530                        cap->count1, PUT_FIXINDENT);
6531     }

Adding a printf, I see that K_LEFTMOUSE and K_RIGHTRELEASE have the following
*negative* values:

   K_LEFTMOUSE=-11517  K_RIGHTRELEASE=-13565

So condition at line normal.c:6526 is always false (bug).

]<MiddleMouse>  in normal mode does not work as a result. It should
do the same as  ]p  according to ":help ]p".

Attached patch fixes it.

-- Dominique

-- 
You received this message from the "vim_dev" 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
diff -r 24100651daa9 src/normal.c
--- a/src/normal.c	Tue Mar 23 18:22:46 2010 +0100
+++ b/src/normal.c	Sun May 02 15:35:45 2010 +0200
@@ -3196,7 +3196,7 @@
      * There are a few special cases where we want certain combinations of
      * characters to be considered as a single word.  These are things like
      * "->", "/ *", "*=", "+=", "&=", "<=", ">=", "!=" etc.  Otherwise, each
-     * character is in it's own class.
+     * character is in its own class.
      */
     if (c != NUL && vim_strchr((char_u *)"-+*/%<>&|^!=", c) != NULL)
 	return 1;
@@ -6523,7 +6523,7 @@
      * [ or ] followed by a middle mouse click: put selected text with
      * indent adjustment.  Any other button just does as usual.
      */
-    else if (cap->nchar >= K_LEFTMOUSE && cap->nchar <= K_RIGHTRELEASE)
+    else if (cap->nchar >= K_RIGHTRELEASE && cap->nchar <= K_LEFTMOUSE)
     {
 	(void)do_mouse(cap->oap, cap->nchar,
 		       (cap->cmdchar == ']') ? FORWARD : BACKWARD,

Raspunde prin e-mail lui