feat(tabs): 补上 Close to the Left,⌘⌥W 关掉其他标签页 - #239
Merged
Conversation
oratis
force-pushed
the
feat/tabs-close-left-shortcut
branch
from
August 23, 2026 16:43
31a754e to
8585f98
Compare
This was referenced Aug 23, 2026
oratis
force-pushed
the
feat/tabs-close-left-shortcut
branch
from
August 23, 2026 16:47
8585f98 to
26ca8fc
Compare
oratis
force-pushed
the
fix/tabs-bulk-close-confirm
branch
from
August 23, 2026 16:47
3ce777d to
db3a417
Compare
oratis
commented
Aug 24, 2026
oratis
left a comment
Owner
Author
There was a problem hiding this comment.
Review
closeSide合并左右两个方向顺手消灭了closeTabsToRight的重复实现,轴心接管激活页的规则两侧一致。- ⌥ 组合按物理键匹配是本 PR 真正的难点,处理是对的:只在「Alt 按下 + key 是合成产物(非 ASCII 或 Dead)」时才退回
e.code,纯 ASCII 一律不动——注释点名了 AltGr 布局靠 Ctrl+Alt 打字这条底线,测试三个方向都覆盖(∑、dead key、ASCII 放行)。 - 一个知道即可的残余风险(不改):Windows 上若某布局的 AltGr+W 产出非 ASCII 字符,会被映射成
Mod+Alt+W从而触发 Close Others 而不是打字。主流布局的 AltGr+W 要么无输出要么是 ASCII(|),且 Windows 端还没发布——真到跨平台发布时再加平台判断也来得及。 - 菜单置灰语义升级为"这一侧没有会被真正关掉的"(而不是"这一侧没有标签页"),和 pinned 契约对齐,三条 close 项一致。
- ⌘⌥W 进
shortcuts.ts而非烧死在原生菜单,自动出现在速查表和改键编辑器——符合设计 §4.6 选它的理由。
没有要改的。
有「Close to the Right」没有「Close to the Left」:看长文顺着 wikilink 一路点进去,最后停在最右边,想关掉左边那一串——没有这个动词。 closeTabsToRight 和新的 closeTabsToLeft 收口成一个 closeSide(), 固定页照旧不动,轴心页留下并在激活页被关掉时接管。 键盘上原本一条关闭类命令都没有(唯一的 ⌘W 烧在原生菜单里,不能改键、 不进速查表)。加 Close Other Tabs = ⌘⌥W,走 shortcuts.ts,所以可改键、 出现在 ⌘⇧/ 速查表和设置里的快捷键编辑器。其余批量动作只上命令面板 + 右键菜单:它们要么天然需要一个轴心,要么本来就是指针场景,占全局键位 不划算。见 docs/design/10-close-many-tabs.md §4.6。 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
review 指出:eventToShortcut 只看 e.key,而 macOS 的 Option 层会先把 字母合成成符号(⌥W → "∑",⌥] → "‘",⌥E → 死键),于是 "Mod+Alt+W" 这类绑定在 macOS 上可能永远匹配不上。这不是本 PR 新引入的——既有的 ⌘⌥S / ⌘⌥T / ⌘⌥B / ⌘⌥] / ⌘⌥[ 走的是同一条路,仓库里没有任何测试或 e2e 用真实的合成字符验过它们。 修法:Alt 按下且 e.key 是合成字符(非 ASCII 或 "Dead")时,键名改从 e.code 取(KeyW → W,BracketRight → ],…)。纯 ASCII 的 Alt 组合不动, AltGr 布局(德语 Ctrl+Alt+Q = @)照旧打字。 没能在真机上验证合成行为(本机未授权驱动应用),所以用合成事件写了 单元测试:∑/KeyW、‘/BracketRight、†/KeyT、Dead/KeyE 都落到预期绑定, @/KeyQ 保持原样。如果真机上 ⌘⌥T 本来就能切主题,这条补丁是惰性的。 另:右键菜单里 Close Others / Close to the Left / Right / All 按"是否 真有非固定页会被关"来置灰,而不是按"那一侧有没有标签页"——固定页永远 排在最前,"左边全是固定页"是常态不是边角。 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
oratis
force-pushed
the
feat/tabs-close-left-shortcut
branch
from
August 24, 2026 04:17
26ca8fc to
8cec189
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
三个叠放 PR 里的 第 2 个,基于 #238(先合那个)。设计:docs/design/10-close-many-tabs.md §1.4、§4.6。
Summary
closeTabsToRight和新的closeTabsToLeft收口成closeSide(),固定页照旧不动,轴心页留下并在激活页被关掉时接管。shortcuts.ts,所以可改键、出现在 ⌘⇧/ 速查表和设置的快捷键编辑器。eventToShortcut只看e.key,而 macOS 的 Option 层会先把字母合成成符号(⌥W →∑,⌥] →‘,⌥E → 死键),所以Mod+Alt+*这一整类绑定——包括既有的 ⌘⌥S / ⌘⌥T / ⌘⌥B / ⌘⌥] / ⌘⌥[——在 macOS 上可能从来没匹配上过。修法:Alt 按下且e.key是合成字符时改从e.code取键名;纯 ASCII 的 Alt 组合不动,AltGr 布局照旧打字。我没能在真机上验证 Option 合成的行为(这轮没有授权驱动应用),上面那条修补是按合成事件的单元测试写的(∑/KeyW、‘/BracketRight、†/KeyT、Dead/KeyE → 预期绑定;@/KeyQ 保持原样)。在现有的 1.0.1 里按一次 ⌘⌥T:能切主题 → 老绑定本来就好,补丁是惰性的;不能切 → review 说对了,补丁顺手把五个老绑定也救活。两种结果都不需要改代码,但值得知道。
How to verify
Checks
pnpm tsc --noEmitcleanpnpm lintcleanpnpm test --rungreen(1033,本 PR +12)cd src-tauri && cargo test— 未动 RustNotes for the reviewer
menu.rs的 accelerator 里没有 Alt+W),也是 Safari 自己的 Close Other Tabs。git rebase --onto main feat/tabs-close-left-shortcut feat/tabs-multi-select再push -f;我会跟。🤖 Generated with Claude Code