changeset 30523:5ab992f09df8 v9.0.0597

patch 9.0.0597: cannot close a tab page with the middle mouse button Commit: https://github.com/vim/vim/commit/3bdef10dc1c836e5e5a6fdcc1c21155cbd80d798 Author: regomne <fallingsunz@gmail.com> Date: Mon Sep 26 20:48:32 2022 +0100 patch 9.0.0597: cannot close a tab page with the middle mouse button 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)
author Bram Moolenaar <Bram@vim.org>
date Mon, 26 Sep 2022 22:00:04 +0200
parents c2b2903782c8
children 7dc3d8cec8db
files src/gui_gtk_x11.c src/gui_w32.c src/version.c
diffstat 3 files changed, 22 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/gui_gtk_x11.c
+++ b/src/gui_gtk_x11.c
@@ -3345,6 +3345,12 @@ on_tabline_menu(GtkWidget *widget, GdkEv
 		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.
--- a/src/gui_w32.c
+++ b/src/gui_w32.c
@@ -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;
     }
--- a/src/version.c
+++ b/src/version.c
@@ -700,6 +700,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    597,
+/**/
     596,
 /**/
     595,