ctlIME // Fix wrong calculation of utf16Cursors with lineHeightRect.
This commit is contained in:
parent
a2f0b94879
commit
ba0e47ad61
|
@ -17,7 +17,7 @@ extension ctlInputMethod {
|
||||||
guard let client = client() else { return }
|
guard let client = client() else { return }
|
||||||
var lineHeightRect = NSRect(x: 0.0, y: 0.0, width: 16.0, height: 16.0)
|
var lineHeightRect = NSRect(x: 0.0, y: 0.0, width: 16.0, height: 16.0)
|
||||||
var cursor = u16Cursor
|
var cursor = u16Cursor
|
||||||
if cursor == displayedText.count, cursor != 0 {
|
if cursor == displayedText.utf16.count, cursor != 0 {
|
||||||
cursor -= 1
|
cursor -= 1
|
||||||
}
|
}
|
||||||
while lineHeightRect.origin.x == 0, lineHeightRect.origin.y == 0, cursor >= 0 {
|
while lineHeightRect.origin.x == 0, lineHeightRect.origin.y == 0, cursor >= 0 {
|
||||||
|
@ -124,8 +124,8 @@ extension ctlInputMethod {
|
||||||
var cursor = 0
|
var cursor = 0
|
||||||
|
|
||||||
if [.ofCandidates, .ofSymbolTable].contains(state.type) {
|
if [.ofCandidates, .ofSymbolTable].contains(state.type) {
|
||||||
cursor = state.data.cursor
|
cursor = state.data.u16Cursor
|
||||||
if cursor == state.displayedText.count, cursor != 0 {
|
if cursor == state.displayedText.utf16.count, cursor != 0 {
|
||||||
cursor -= 1
|
cursor -= 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue