File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed
app/src/main/java/com/osfans/trime/ime Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -849,7 +849,7 @@ open class TrimeInputMethodService : LifecycleInputMethodService() {
849
849
etr.token = 0
850
850
val et = ic.getExtractedText(etr, 0 )
851
851
if (et != null ) {
852
- if (et.selectionEnd - et.selectionStart > 0 ) return ic.performContextMenuAction(android.R .id.cut)
852
+ if (et.selectionStart != et.selectionEnd ) return ic.performContextMenuAction(android.R .id.cut)
853
853
}
854
854
}
855
855
Timber .w(" hookKeyboard cut fail" )
@@ -863,7 +863,7 @@ open class TrimeInputMethodService : LifecycleInputMethodService() {
863
863
etr.token = 0
864
864
val et = ic.getExtractedText(etr, 0 )
865
865
if (et != null ) {
866
- if (et.selectionEnd - et.selectionStart > 0 ) return ic.performContextMenuAction(android.R .id.copy)
866
+ if (et.selectionStart != et.selectionEnd ) return ic.performContextMenuAction(android.R .id.copy)
867
867
}
868
868
}
869
869
Timber .w(" hookKeyboard copy fail" )
Original file line number Diff line number Diff line change @@ -291,15 +291,15 @@ class CommonKeyboardActionListener(
291
291
? : Rime .getRimeKeycodeByName(Keycode .keyNameOf(keyEventCode))
292
292
val modifiers = KeyModifiers .fromMetaState(metaState).modifiers
293
293
service.postRimeJob {
294
+ if (service.hookKeyboard(keyEventCode, metaState)) {
295
+ Timber .d(" handleKey: hook" )
296
+ return @postRimeJob
297
+ }
294
298
if (processKey(value, modifiers)) {
295
299
shouldReleaseKey = true
296
300
Timber .d(" handleKey: processKey" )
297
301
return @postRimeJob
298
302
}
299
- if (service.hookKeyboard(keyEventCode, metaState)) {
300
- Timber .d(" handleKey: hook" )
301
- return @postRimeJob
302
- }
303
303
if (AppUtils .launchKeyCategory(service, keyEventCode)) {
304
304
Timber .d(" handleKey: openCategory" )
305
305
return @postRimeJob
You can’t perform that action at this time.
0 commit comments