diff --git a/supacode/App/WindowTabbingDisabler.swift b/supacode/App/WindowTabbingDisabler.swift index 9c70b35b..17e8ac1d 100644 --- a/supacode/App/WindowTabbingDisabler.swift +++ b/supacode/App/WindowTabbingDisabler.swift @@ -31,7 +31,13 @@ final class WindowTabbingView: NSView, NSWindowDelegate { } func windowShouldClose(_ sender: NSWindow) -> Bool { - sender.orderOut(nil) + if Self.shouldOrderOutOnClose(styleMask: sender.styleMask) { + sender.orderOut(nil) + } return false } + + static func shouldOrderOutOnClose(styleMask: NSWindow.StyleMask) -> Bool { + !styleMask.contains(.fullScreen) + } } diff --git a/supacodeTests/WindowTabbingDisablerTests.swift b/supacodeTests/WindowTabbingDisablerTests.swift new file mode 100644 index 00000000..e1165da0 --- /dev/null +++ b/supacodeTests/WindowTabbingDisablerTests.swift @@ -0,0 +1,14 @@ +import AppKit +import Testing + +@testable import supacode + +struct WindowTabbingDisablerTests { + @Test func shouldNotOrderOutFullscreenWindowOnClose() { + #expect(WindowTabbingView.shouldOrderOutOnClose(styleMask: [.titled, .fullScreen]) == false) + } + + @Test func shouldOrderOutNonFullscreenWindowOnClose() { + #expect(WindowTabbingView.shouldOrderOutOnClose(styleMask: [.titled, .closable]) == true) + } +}