Skip to content

Commit 24cb0c9

Browse files
FichteFollclaude
andcommitted
Skip focus restoration when closing an inactive tab
`on_pre_close` restored the group's previous selection for every closing sheet, so closing a background tab pulled the focus to the previously active tab. Restore only when the closing sheet is the active sheet of its group. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent 407d3b7 commit 24cb0c9

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

‎plugin/listener.py‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,11 @@ def on_pre_close(self, view: sublime.View) -> None:
140140
if window is None:
141141
return
142142

143+
# Closing an inactive tab does not change the focus,
144+
# so there is nothing to restore.
145+
if window.active_sheet_in_group(group) != sheet:
146+
return
147+
143148
state = get_state(window)
144149
if state.session_active:
145150
return

0 commit comments

Comments
 (0)