Merge pull request #103 from l0ng-ai/feat/tab-double-click-zoom

feat(tabs): double-click on tab zooms window instead of renaming
This commit is contained in:
l0ng-ai
2026-07-16 12:48:23 +08:00
committed by GitHub
2 changed files with 14 additions and 14 deletions
+4 -7
View File
@@ -209,16 +209,13 @@ impl Tty7App {
)
// Branch + diff line, when the pane sits in a git repo.
.children(git_line)
// Single click activates; double click starts a rename.
// Click activates. (Renaming lives in the context menu,
// matching the strip — no double-click rename.)
.on_mouse_down(
MouseButton::Left,
cx.listener(move |this, ev: &MouseDownEvent, window, cx| {
cx.listener(move |this, _: &MouseDownEvent, window, cx| {
cx.stop_propagation();
if ev.click_count >= 2 {
this.start_rename(i, window, cx);
} else {
this.activate(i, window, cx);
}
this.activate(i, window, cx);
}),
)
// Drag the row by its label to reorder it (shared `DragTab`).
+10 -7
View File
@@ -393,8 +393,9 @@ impl Tty7App {
let has_cwd = cwd.is_some();
let mut menu = menu.min_w(px(200.));
// Rename — the same inline edit a label double-click starts, given a
// discoverable entry point.
// Rename — the inline label edit's only entry point (a label
// double-click zooms the window instead, like the rest of the
// titlebar).
menu = menu.item(PopupMenuItem::new("Rename Tab").on_click({
let app = app.clone();
move |_, window, cx| {
@@ -593,16 +594,18 @@ impl Tty7App {
// from the type, not from colour alone.
.when(is_active, |d| d.font_weight(FontWeight::MEDIUM))
.child(label)
// Single click activates; double click starts a rename.
// Single click activates; double click zooms the window,
// same as the rest of the titlebar. (Renaming lives in the
// context menu.)
.on_mouse_down(
MouseButton::Left,
cx.listener(move |this, ev: &MouseDownEvent, window, cx| {
// Swallow the event so it never reaches the enclosing
// TitleBar, whose double-click handler would otherwise
// zoom/maximize the window on a rename double-click.
// Swallow the event — on Windows the chip's `occlude()`
// means it would never reach the TitleBar anyway, so we
// forward the double-click zoom explicitly instead.
cx.stop_propagation();
if ev.click_count >= 2 {
this.start_rename(i, window, cx);
window.titlebar_double_click();
} else {
this.activate(i, window, cx);
}