Skip to content

feat(ui): a middle click closes a tab (#1853) - #1920

Merged
echelon merged 1 commit into
storytold:mainfrom
mtlcl410:feat/middle-click-closes-tab
Oct 15, 2026
Merged

echelon merged 1 commit into
storytold:mainfrom
mtlcl410:feat/middle-click-closes-tab

Conversation

@mtlcl410

Copy link
Copy Markdown
Contributor

What this changes

Fixes #1853. A middle click on a tab closes it, as in Acrobat and browsers.

  • A document tab goes through the same path as its close button (close = Some(i) → Action::Close → request_close_tab), so a document with unsaved changes asks first instead of closing.
  • The Combine files tab closes on a middle click too.
  • Nothing else changes: a left click still activates the tab, and the context menu is as before.

Middle-button auto-scroll (autoscroll.rs) only starts inside the document viewport, so it doesn't see a click on the tab strip. Response::middle_clicked is egui's own per-button click tracking on the tab's existing click sense.

How you verified it

Test. a_middle_click_closes_the_tab (kittest) opens two documents, middle-clicks the first tab and requires that only the second remains, with no close prompt. It then edits the remaining document, middle-clicks its tab and requires that it is still open and a close request is pending.

With chrome.rs reverted the test fails: left: 2, right: 1 (both tabs still open).

Never-crash

  • No new unwrap/expect/indexing outside tests
  • No unsafe

Provenance

  • No assets, no external code. The behaviour is the common tab convention the issue describes.

Security

  • No paths, MCP, control channel or network involved

Parity and reach

  • A small interface convention; no parity/ entry describes tab gestures, so none changes. Not a headless operation, so no automation tool.

🤖 Generated with Claude Code

@mtlcl410
mtlcl410 force-pushed the feat/middle-click-closes-tab branch from f21e9c6 to 664d2cb Compare October 13, 2026 22:37
As in Acrobat and browsers. A document tab with unsaved changes asks first,
through the same close request as its close button; the Combine files tab
closes too.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RUNQSPVXx3dDBabRZHAnjz
@mtlcl410
mtlcl410 force-pushed the feat/middle-click-closes-tab branch from 664d2cb to 5d81968 Compare October 14, 2026 04:46
@echelon
echelon merged commit 668f491 into storytold:main Oct 15, 2026
5 checks passed
@echelon

echelon commented Oct 15, 2026

Copy link
Copy Markdown
Member

Thank you @mtlcl410 for closing tabs with a middle click! It's merged into main now.

If you haven't already, please come and join us on Discord: https://discord.gg/artcraft

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Middle mouse not closing tabs

2 participants