]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.0.0597: cannot close a tab page with the middle mouse button v9.0.0597
authorregomne <fallingsunz@gmail.com>
Mon, 26 Sep 2022 19:48:32 +0000 (20:48 +0100)
committerBram Moolenaar <Bram@vim.org>
Mon, 26 Sep 2022 19:48:32 +0000 (20:48 +0100)
Problem:    Cannot close a tab page with the middle mouse button.
Solution:   Support closing a tab page with the middle mouse button, like many
            other programs. (closes #10746)

src/gui_gtk_x11.c
src/gui_w32.c
src/version.c

index 3cdf22260ab988e490115a47d923cb042e291170..945cb09ca925a293ce1f0a91eba144a90e865edb 100644 (file)
@@ -3345,6 +3345,12 @@ on_tabline_menu(GtkWidget *widget, GdkEvent *event)
                send_tabline_event(x < 50 ? -1 : 0);
            }
        }
+       else if (bevent->button == 2)
+       {
+           if (clicked_page != 0)
+               // Middle mouse click on tabpage label closes that tab.
+               send_tabline_menu_event(clicked_page, TABLINE_MENU_CLOSE);
+       }
     }
 
     // We didn't handle the event.
index 203b8fa54805648fd9ef4188f131b611bae00c0c..3ade63113b03517daf09dd0df100a7e7e65c44cd 100644 (file)
@@ -8094,6 +8094,20 @@ tabline_wndproc(
                }
                break;
            }
+       case WM_MBUTTONUP:
+           {
+               TCHITTESTINFO htinfo;
+
+               htinfo.pt.x = GET_X_LPARAM(lParam);
+               htinfo.pt.y = GET_Y_LPARAM(lParam);
+               idx0 = TabCtrl_HitTest(hwnd, &htinfo);
+               if (idx0 != -1)
+               {
+                   idx0 += 1;
+                   send_tabline_menu_event(idx0, TABLINE_MENU_CLOSE);
+               }
+               break;
+           }
        default:
            break;
     }
index 3111b4f9225f5b2162021ac9a5db6acdd3caeb24..d6535b3928a651495820be991fd608b9373eb9d5 100644 (file)
@@ -699,6 +699,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    597,
 /**/
     596,
 /**/