Typing using a Thai keyboard causes a crash
**Describe the bug**
Using a Thai keyboard with SwiftTerm on iOS causes the entire app to crash after a few key press
**To Reproduce**
- start an app on iOS using SwiftTerm (for example the AppStore version of a-Shell mini, but any app will do)
- switch to the "5 rows" keyboard for the Thai language (iOS 26) or the single Thai keyboard (iPadOS 18),
- start typing randomly
- after two-three keys, the application crashes. According to the debugger, the issue happens in:
```swift
private func commitTextInput(_ text: String, applyModifiers: Bool)
```
at the following line:
```swift
textInputStorage.replaceSubrange(rangeToReplace.fullRange(in: textInputStorage), with: textToInsert)
```
with the error: Fatal error: String index is out of bounds.
I suspect Thai is similar to the Korean language (multiple characters being combined into one), but I haven't found a tutorial yet.
A user left the following AppStore review: "อัพเดทแล้วแป้นพิมพ์สลับเองตอนกด enter ทำให้เกิดข้อผิดพลาดบ่อย", which was translated as: "After the update, the keyboard switches automatically when pressing enter, causing frequent errors". I haven't been able to reproduce that one. It's possible that they use a custom keyboard defined in an app, there are several popular apps for Thai keyboards.
**Expected behavior**
I would expect to be able to type using a Thai keyboard, without crashing.
**Smartphone (please complete the following information):**
- Device: iPad Pro and iPhone SE
- OS: iPadOS 16 and iOS 26
关闭于 2026-05-17 5 条评论