From 77e2c3f62a5e60a7ffbdd30e098efaa975ced4e9 Mon Sep 17 00:00:00 2001 From: EhsanAzish80 Date: Mon, 10 Aug 2026 17:29:39 +0300 Subject: [PATCH 1/2] Preserve sketch pad in typing mode --- .../ZoomItMacCore/Overlay/ZoomCanvasView.swift | 17 +++++++++++++---- .../ZoomItMacCore/SelfTest/SelfTestRunner.swift | 10 +++++++++- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/Sources/ZoomItMacCore/Overlay/ZoomCanvasView.swift b/Sources/ZoomItMacCore/Overlay/ZoomCanvasView.swift index 63d2254..681aa7d 100644 --- a/Sources/ZoomItMacCore/Overlay/ZoomCanvasView.swift +++ b/Sources/ZoomItMacCore/Overlay/ZoomCanvasView.swift @@ -54,7 +54,10 @@ final class ZoomCanvasView: NSView { switch interactionMode { case .typing: let wasDrawing = isDrawingMode - exitDrawingMode(restoreCursor: false) + exitDrawingMode( + restoreCursor: false, + clearBlankScreen: Self.clearsBlankScreenWhenLeavingDrawing(for: interactionMode) + ) // When coming from drawing, the pen dot is already tracked in // pointerViewPoint; exitDrawingMode warps the system cursor, so // don't re-read the mouse. Otherwise sync to the real cursor so @@ -502,6 +505,10 @@ final class ZoomCanvasView: NSView { return .penColor } + static func clearsBlankScreenWhenLeavingDrawing(for mode: AppMode) -> Bool { + mode != .typing + } + private func drawTypingCaret(in context: CGContext, source: CGRect) { guard let caret = annotationController.typingCaret() else { return } let color = annotationController.currentStyle.color.nsColor @@ -559,12 +566,14 @@ final class ZoomCanvasView: NSView { updateLiveZoomInteractivity() } - private func exitDrawingMode(restoreCursor: Bool = true) { + private func exitDrawingMode(restoreCursor: Bool = true, clearBlankScreen: Bool = true) { guard isDrawingMode else { return } isDrawingMode = false isStroking = false activeStrokeTool = nil - blankScreen = nil + if clearBlankScreen { + blankScreen = nil + } stopDrawingRightClickMonitor() // Keep the zoom anchored where it was while drawing. The physical mouse // moved around the screen while drawing, so warp the (hidden) system @@ -960,4 +969,4 @@ final class ZoomCanvasView: NSView { context.fillEllipse(in: rect) context.restoreGState() } -} \ No newline at end of file +} diff --git a/Sources/ZoomItMacCore/SelfTest/SelfTestRunner.swift b/Sources/ZoomItMacCore/SelfTest/SelfTestRunner.swift index 2397e50..f8ced36 100644 --- a/Sources/ZoomItMacCore/SelfTest/SelfTestRunner.swift +++ b/Sources/ZoomItMacCore/SelfTest/SelfTestRunner.swift @@ -58,6 +58,7 @@ public enum SelfTestRunner { try testSettingsWindowStaysOnTop() try testZoomAndLiveZoomAreSeparateTabs() try testBlankScreenUsesControlKeys() + try testTypingPreservesBlankScreen() try testTypeTabFontSampleUsesSelectedFont() try testMenuBarIconIsPaddedTemplate() try testStandardIconIsRoundedSquareWithMargin() @@ -702,6 +703,13 @@ public enum SelfTestRunner { "Expected Ctrl+W/K outside drawing mode to fall back to the pen colour") } + private static func testTypingPreservesBlankScreen() throws { + try expect(!ZoomCanvasView.clearsBlankScreenWhenLeavingDrawing(for: .typing), + "Expected entering typing mode to preserve the sketch-pad background") + try expect(ZoomCanvasView.clearsBlankScreenWhenLeavingDrawing(for: .staticZoom), + "Expected a normal drawing-mode exit to clear the sketch-pad background") + } + /// The Type tab's "Sample" preview must render in the selected typing font /// (it previously always used the system font, so font changes weren't /// visible). Also verify the preview size is clamped to a legible range. @@ -1729,4 +1737,4 @@ private extension Array { Array(self[start.. Date: Mon, 10 Aug 2026 17:37:35 +0300 Subject: [PATCH 2/2] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- Sources/ZoomItMacCore/SelfTest/SelfTestRunner.swift | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Sources/ZoomItMacCore/SelfTest/SelfTestRunner.swift b/Sources/ZoomItMacCore/SelfTest/SelfTestRunner.swift index f8ced36..cdb87ed 100644 --- a/Sources/ZoomItMacCore/SelfTest/SelfTestRunner.swift +++ b/Sources/ZoomItMacCore/SelfTest/SelfTestRunner.swift @@ -705,9 +705,14 @@ public enum SelfTestRunner { private static func testTypingPreservesBlankScreen() throws { try expect(!ZoomCanvasView.clearsBlankScreenWhenLeavingDrawing(for: .typing), - "Expected entering typing mode to preserve the sketch-pad background") - try expect(ZoomCanvasView.clearsBlankScreenWhenLeavingDrawing(for: .staticZoom), - "Expected a normal drawing-mode exit to clear the sketch-pad background") + "Expected leaving drawing for typing mode to preserve the sketch-pad background") + + let modesThatShouldClear: [AppMode] = [.idle, .staticZoom, .drawOnly, .liveZoom, .captureSelection, + .panoramaCapture, .recording, .breakTimer] + for mode in modesThatShouldClear { + try expect(ZoomCanvasView.clearsBlankScreenWhenLeavingDrawing(for: mode), + "Expected leaving drawing for \(mode) to clear the sketch-pad background") + } } /// The Type tab's "Sample" preview must render in the selected typing font