Skip to content

Commit

Permalink
fix using Shift to select results in clearing selected text (#168)
Browse files Browse the repository at this point in the history
  • Loading branch information
eagleoflqj committed Jul 4, 2024
1 parent 3b6bf03 commit 9bfd58f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion macosfrontend/macosfrontend.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ public func commitAndSetPreeditSync(
// Without client preedit, Backspace bypasses IM in Terminal, every key
// is both processed by IM and passed to client in iTerm, so we force a
// dummy client preedit here.
if preedit.isEmpty && dummyPreedit {
// Some apps also need it to get accurate cursor position to place candidate window.
// But when there is selected text, we don't want the dummy preedit to clear all of
// them. An example is using Shift+click to select but IM switch happens.
if preedit.isEmpty && dummyPreedit && client.selectedRange().length == 0 {
setPreedit(client, " ", 0)
} else {
setPreedit(client, preedit, cursorPos)
Expand Down

0 comments on commit 9bfd58f

Please sign in to comment.