From 58f647f89671efaf5fb85fdd9bc2ae0d105ee717 Mon Sep 17 00:00:00 2001 From: Dilrvvr Date: Fri, 3 Apr 2026 17:19:11 +0800 Subject: [PATCH] Fix cut selection not collapsing after cut operation The cut() method was not notifying inputDelegate about the selection change, unlike paste() which properly calls selectionWillChange/ selectionDidChange. This caused the visual selection highlight to persist after cutting text. Co-Authored-By: Claude Opus 4.6 (1M context) --- Sources/Runestone/TextView/Core/TextInputView.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Sources/Runestone/TextView/Core/TextInputView.swift b/Sources/Runestone/TextView/Core/TextInputView.swift index a7b2f2c1..e68dba29 100644 --- a/Sources/Runestone/TextView/Core/TextInputView.swift +++ b/Sources/Runestone/TextView/Core/TextInputView.swift @@ -730,7 +730,9 @@ final class TextInputView: UIView, UITextInput { override func cut(_ sender: Any?) { if let selectedTextRange = selectedTextRange, let text = text(in: selectedTextRange) { UIPasteboard.general.string = text + inputDelegate?.selectionWillChange(self) replace(selectedTextRange, withText: "") + inputDelegate?.selectionDidChange(self) } }