From a0008de55d0640998001b48ea53dbf96b8a753a3 Mon Sep 17 00:00:00 2001 From: Beingpax Date: Fri, 25 Jul 2025 10:51:23 +0545 Subject: [PATCH] Revert "Clipboard logic and naming update" This reverts commit 9d2c61808f088fa0b3a4696c6ed1165db59b5491. --- VoiceInk/CursorPaster.swift | 14 ++++++++------ VoiceInk/Whisper/WhisperState.swift | 8 ++------ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/VoiceInk/CursorPaster.swift b/VoiceInk/CursorPaster.swift index 2fa7333..9ce08bb 100644 --- a/VoiceInk/CursorPaster.swift +++ b/VoiceInk/CursorPaster.swift @@ -9,12 +9,14 @@ class CursorPaster { var savedContents: [(NSPasteboard.PasteboardType, Data)] = [] - let currentItems = pasteboard.pasteboardItems ?? [] - - for item in currentItems { - for type in item.types { - if let data = item.data(forType: type) { - savedContents.append((type, data)) + if shouldPreserveClipboard { + let currentItems = pasteboard.pasteboardItems ?? [] + + for item in currentItems { + for type in item.types { + if let data = item.data(forType: type) { + savedContents.append((type, data)) + } } } } diff --git a/VoiceInk/Whisper/WhisperState.swift b/VoiceInk/Whisper/WhisperState.swift index d91b9be..74d7ee9 100644 --- a/VoiceInk/Whisper/WhisperState.swift +++ b/VoiceInk/Whisper/WhisperState.swift @@ -335,14 +335,10 @@ class WhisperState: NSObject, ObservableObject { SoundManager.shared.playStopSound() DispatchQueue.main.asyncAfter(deadline: .now() + 0.05) { - let originalClipboardContent = ClipboardManager.getClipboardContent() - CursorPaster.pasteAtCursor(text, shouldPreserveClipboard: !self.isAutoCopyEnabled) - if self.isAutoCopyEnabled, let originalContent = originalClipboardContent { - DispatchQueue.main.asyncAfter(deadline: .now() + 0.4) { - ClipboardManager.copyToClipboard(originalContent) - } + if self.isAutoCopyEnabled { + ClipboardManager.copyToClipboard(text) } // Automatically press Enter if the active Power Mode configuration allows it.