diff --git a/Neon Vision Editor.xcodeproj/project.pbxproj b/Neon Vision Editor.xcodeproj/project.pbxproj index 68bbde0..738bebf 100644 --- a/Neon Vision Editor.xcodeproj/project.pbxproj +++ b/Neon Vision Editor.xcodeproj/project.pbxproj @@ -263,6 +263,7 @@ ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO; AUTOMATION_APPLE_EVENTS = NO; CODE_SIGN_IDENTITY = "Apple Development"; + "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 105; DEAD_CODE_STRIPPING = YES; @@ -335,6 +336,7 @@ ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO; AUTOMATION_APPLE_EVENTS = NO; CODE_SIGN_IDENTITY = "Apple Development"; + "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 105; DEAD_CODE_STRIPPING = YES; diff --git a/Neon Vision Editor/UI/EditorTextView.swift b/Neon Vision Editor/UI/EditorTextView.swift index f587c3a..21890f0 100644 --- a/Neon Vision Editor/UI/EditorTextView.swift +++ b/Neon Vision Editor/UI/EditorTextView.swift @@ -39,10 +39,16 @@ final class AcceptingTextView: NSTextView { } override func mouseDown(with event: NSEvent) { + cancelPendingPasteCaretEnforcement() super.mouseDown(with: event) window?.makeFirstResponder(self) } + override func scrollWheel(with event: NSEvent) { + cancelPendingPasteCaretEnforcement() + super.scrollWheel(with: event) + } + override func becomeFirstResponder() -> Bool { let didBecome = super.becomeFirstResponder() if didBecome, UserDefaults.standard.bool(forKey: vimModeDefaultsKey) { @@ -517,6 +523,11 @@ final class AcceptingTextView: NSTextView { } } + private func cancelPendingPasteCaretEnforcement() { + pendingPasteCaretLocation = nil + NSObject.cancelPreviousPerformRequests(withTarget: self, selector: #selector(applyPendingPasteCaret), object: nil) + } + @objc private func applyPendingPasteCaret() { guard let desired = pendingPasteCaretLocation else { return }