Double-click tab to rename

This commit is contained in:
mcrmck 2026-03-04 23:37:16 -05:00
parent e1a14551fa
commit f3b9a2d7d8

View file

@ -1725,6 +1725,19 @@ def handle_tab_bar_mouse(self, x: float, y: float, button: int, modifiers: int,
else:
drag_started = get_tab_being_dragged()[1]
if not drag_started:
if len(self.recent_mouse_events) > 2:
ci = get_click_interval()
prev, prev2 = self.recent_mouse_events[-1], self.recent_mouse_events[-2]
if (
prev.button == button and prev2.button == button and
prev.action == GLFW_PRESS and prev2.action == GLFW_RELEASE and
prev.tab_id == tab.id and prev2.tab_id == tab.id and
now - prev.at <= ci and now - prev2.at <= 2 * ci
): # double click on tab
get_boss().set_tab_title()
self.recent_mouse_events.clear()
set_tab_being_dragged()
return
self.set_active_tab(tab)
set_tab_being_dragged()
elif button == GLFW_MOUSE_BUTTON_MIDDLE: