Skip to content

Commit 8bc13c8

Browse files
alvarolbclaude
andcommitted
Fix keyboard toggle flicker on iOS
Replace resignFirstResponder/becomeFirstResponder cycle with reloadInputViews() wrapped in performWithoutAnimation when switching between the standard keyboard and the custom KeyboardView. This avoids the keyboard dismiss/show animation that causes multiple layout passes and terminal flickering. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 14b0a2d commit 8bc13c8

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

Sources/SwiftTerm/iOS/iOSAccessoryView.swift

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,7 @@ public class TerminalAccessory: UIInputView, UIInputViewAudioFeedback {
149149

150150
@objc func toggleInputKeyboard (_ sender: UIButton) {
151151
guard let tv = terminalView else { return }
152-
let wasResponder = tv.isFirstResponder
153-
if wasResponder { _ = tv.resignFirstResponder() }
154-
152+
155153
if tv.inputView == nil {
156154
#if os(visionOS)
157155
tv.inputView = KeyboardView (frame: CGRect (origin: CGPoint.zero,
@@ -167,8 +165,9 @@ public class TerminalAccessory: UIInputView, UIInputViewAudioFeedback {
167165
} else {
168166
tv.inputView = nil
169167
}
170-
if wasResponder { _ = tv.becomeFirstResponder() }
171-
168+
UIView.performWithoutAnimation {
169+
tv.reloadInputViews()
170+
}
172171
}
173172

174173
@objc func toggleTouch (_ sender: UIButton) {

0 commit comments

Comments
 (0)