From 6652df5e863822d2dc25c58e2557fea7e7a18da5 Mon Sep 17 00:00:00 2001 From: Khan Winter <35942988+thecoolwinter@users.noreply.github.com> Date: Sat, 3 Feb 2024 00:36:18 -0600 Subject: [PATCH] Correctly Lose Focus --- .../Controller/TextViewController+Cursor.swift | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Sources/CodeEditSourceEditor/Controller/TextViewController+Cursor.swift b/Sources/CodeEditSourceEditor/Controller/TextViewController+Cursor.swift index 82c9124f0..5549a1d6d 100644 --- a/Sources/CodeEditSourceEditor/Controller/TextViewController+Cursor.swift +++ b/Sources/CodeEditSourceEditor/Controller/TextViewController+Cursor.swift @@ -13,8 +13,6 @@ extension TextViewController { /// - Parameter positions: The positions to set. Lines and columns are 1-indexed. public func setCursorPositions(_ positions: [CursorPosition]) { if isPostingCursorNotification { return } - _ = textView.becomeFirstResponder() - var newSelectedRanges: [NSRange] = [] for position in positions { let line = position.line @@ -48,9 +46,9 @@ extension TextViewController { let row = linePosition.index + 1 positions.append(CursorPosition(range: selectedRange.range, line: row, column: column)) } - cursorPositions = positions.sorted(by: { $0.range.location < $1.range.location }) isPostingCursorNotification = true + cursorPositions = positions.sorted(by: { $0.range.location < $1.range.location }) NotificationCenter.default.post(name: Self.cursorPositionUpdatedNotification, object: nil) isPostingCursorNotification = false }