close_file after decompression closes the active tab, not the compressed file's tab (can close unrelated tabs)
After decompressing, load_decompress() closes "the window's active tab" instead of the compressed file's tab, so if the active tab changed while the file was being decompressed (or several compressed files are opened at once), an unrelated tab of the user is closed and the original compressed hex view stays open.
window.run_command('close_file') # closes the ACTIVE view, not `view`
decomp_view = window.open_file(file_temp)
Reproduced on Sublime Text build 4215 (portable copy, Windows 11): one scratch tab MY-OTHER-TAB ("unrelated work"), then open a.txt.gz and switch back to the other tab right away (what happens when you click another tab or open the file in the background):
before: views = [MY-OTHER-TAB]
after: views = [a.txt.gz (hex dump, 165 chars), a.txt (decompressed temp file)]
MY-OTHER-TAB still valid: False
Opening three files at once (.gz, .bz2, .xz) gave the same kind of mess: only the first was decompressed, the other two stayed as hex dumps, and one of the tabs was closed. Opening a single compressed file while staying on its tab works. With a dirty tab this also raises Sublime's "Save changes?" dialog for a file the user never asked to close.
Fix: close the specific view, e.g. view.close() from a command context (window.focus_view(view); window.run_command('close_file') is still racy) or sublime.set_timeout(view.close, 0); also do the whole flow off the main thread with view.id() bookkeeping instead of relying on which tab is active.
Found while testing packages from the Package Control catalog.
thanks will get a look at it
Hello @dpc00, would you kindly share the version you have installed ?
It is Compressor 0.0.6 (released 2023-06-22), installed from Package Control; that is still the latest tag and the latest commit on master, so it is what I tested on 2026-09-25. I just installed it again from Package Control to confirm: Package Control reports Installed package "Compressor" 0.0.6. Sublime Text build 4215 on Windows 11.
(Written by Claude, working with @dpc00.)
Thank for the quick turnaround, finally got some time to work on it