osfans / trime

同文安卓輸入法平臺3.x/Android-rime/Rime Input Method Engine for Android
http://osfans.github.io/trime/
GNU General Public License v3.0
3.09k stars 372 forks source link

The `Return` key always registered twice when using it in `termux` app. #957

Closed amalgame21 closed 1 year ago

amalgame21 commented 1 year ago

Describe the bug Every time I press Enter/前往/Return inside the termux app, it will be registered twice. Other keys are working fine. This behaviour only present in v3.2.11, even without default.custom.yaml and trime.custom.yaml files. Tested on Android 12 and 13, same result. Other apps apparently do not have this issue.

To Reproduce Steps to reproduce the bug:

  1. Go to 'termux' app
  2. Click on 'Enter'
  3. Returned two prompt instead of one.

Expected behavior Pressing of Return button once only register one Return key

Smartphone (please complete the following information):

Additional context I updated the app from v3.2.9 to v3.2.11. This behaviour only present in v3.2.11 not v3.2.9

wxyzh commented 1 year ago

这个问题似乎和Meta有关,当在termux的使用快捷键盘按下alt之后再按同文enter时是正常的。

D/Keyboard( 9835): keyState() ctrl=false, alt=false, shift=false, sym=false, meta=false onBufferDraw, drawSingleKey=false D/Keyboard( 9835): keyState() ctrl=false, alt=false, shift=false, sym=false, meta=false getCurrentDrawableState() Key=Shift states=3 on=false isShifted=false pressed=false sticky=false D/KeyboardView( 9835): onBufferDraw() keyBackground==null, key=Shift D/Trime ( 9835): handleKey() EnterOrHide, keycode=66 D/KeyboardView( 9835): releaseKey() key=66, mComboCount=0, mComboMode=false 日志片段如下:

D/Trime   ( 9835):  <TrimeInit> onWindowHidden  eventListeners
I/Trime   ( 9835): NotFullscreenMode
D/WindowManager( 9835): don't allow trim: visibility=0, renderEnable=true
D/ActivityThread( 9835): do gfx trim 40 failed
D/VRI[InputMethod]( 9835): registerCallbacksForSync syncBuffer=false
D/VRI[InputMethod]( 9835): Received frameCommittedCallback lastAttemptedDrawFrameNum=2 didProduceBuffer=true syncBuffer=false
D/VRI[InputMethod]( 9835): draw finished.
D/Trime   ( 9835): onStartInput: restarting=false
I/Trime   ( 9835): NotFullscreenMode
D/Trime   ( 9835): onStartInputView: restarting=false
I/Trime   ( 9835): auto dark off
D/Trime   ( 9835): updateComposing() SymbolKeyboardType=NO_KEY
D/Composition( 9835): setWindow Rime.getComposition(), [1]com.osfans.trime.ime.text.Composition.setWindow(Composition.java:536), [2]com.osfans.trime.ime.core.Trime.updateComposing(Trime.java:1215), [3]com.osfans.trime.ime.core.Trime.selectLiquidKeyboard(Trime.java:430)
I/ScrollView( 9835): ScroolView move(0 0), scroll=0
D/KeyboardView( 9835):  <TrimeInput>    invalidateAllKeys()
I/KeyboardView( 9835): onBufferDraw() keyCount=33, drawSingleKey=false, invalidKeyIsNull=true
D/Keyboard( 9835):  <TrimeInput>    keyState() ctrl=false, alt=false, shift=false, sym=false, meta=false    onBufferDraw, drawSingleKey=false
D/Keyboard( 9835):  <TrimeInput>    keyState() ctrl=false, alt=false, shift=false, sym=false, meta=false    getCurrentDrawableState() Key=Shift states=3 on=false isShifted=false pressed=false sticky=false
D/KeyboardView( 9835): onBufferDraw() keyBackground==null, key=Shift
D/KeyboardView( 9835):  <TrimeInput>    invalidateAllKeys()
I/Trime   ( 9835): EditorInfo: normal; packageName=com.termux; fieldName=null; actionLabel=null; inputType=0; VARIATION=0; CLASS=0; ACTION=0
I/Trime   ( 9835): onWindowShown...
D/Trime   ( 9835): updateComposing() SymbolKeyboardType=NO_KEY
D/Composition( 9835): setWindow Rime.getComposition(), [1]com.osfans.trime.ime.text.Composition.setWindow(Composition.java:536), [2]com.osfans.trime.ime.core.Trime.updateComposing(Trime.java:1215), [3]com.osfans.trime.ime.core.Trime.onWindowShown(Trime.java:263)
I/ScrollView( 9835): ScroolView move(0 0), scroll=0
D/KeyboardView( 9835):  <TrimeInput>    invalidateAllKeys()
I/KeyboardView( 9835): onBufferDraw() keyCount=33, drawSingleKey=false, invalidKeyIsNull=true
D/Keyboard( 9835):  <TrimeInput>    keyState() ctrl=false, alt=false, shift=false, sym=false, meta=false    onBufferDraw, drawSingleKey=false
D/Keyboard( 9835):  <TrimeInput>    keyState() ctrl=false, alt=false, shift=false, sym=false, meta=false    getCurrentDrawableState() Key=Shift states=3 on=false isShifted=false pressed=false sticky=false
D/KeyboardView( 9835): onBufferDraw() keyBackground==null, key=Shift
D/VRI[InputMethod]( 9835): registerCallbacksForSync syncBuffer=false
D/VRI[InputMethod]( 9835): Received frameCommittedCallback lastAttemptedDrawFrameNum=3 didProduceBuffer=true syncBuffer=false
D/VRI[InputMethod]( 9835): draw finished.
I/Trime   ( 9835): NotFullscreenMode
I/Trime   ( 9835): Ignoring (is already shown)
D/AutofillManager( 9835): Fill dialog is enabled:false, hints=[]
V/AutofillManager( 9835): requestHideFillUi(null): anchor = null
V/AutofillManager( 9835): No AutofillClient for com.osfans.trime.debug on context com.osfans.trime.TrimeImeService@41da859
D/KeyboardView( 9835):  <TrimeInput>    onModifiedTouchEvent()  onModifiedTouchEvent
D/KeyboardView( 9835): swipeDebug.onModifiedTouchEvent before gesture, action != UP
D/KeyboardView( 9835):  <TrimeInput>    invalidateKey() keyIndex=32, mKeysExist=true
I/KeyboardView( 9835): onBufferDraw() keyCount=33, drawSingleKey=true, invalidKeyIsNull=false
D/Keyboard( 9835):  <TrimeInput>    keyState() ctrl=false, alt=false, shift=false, sym=false, meta=false    onBufferDraw, drawSingleKey=true
D/KeyboardView( 9835):  <TrimeInput>    invalidateKey() invalidate
D/KeyboardView( 9835):  <TrimeInput>    invalidateKey() finish
D/KeyboardView( 9835):  <TrimeInput>    onModifiedTouchEvent()  not actionDown done
D/KeyboardView( 9835): swipeDebug.onTouchEvent ?, action = ACTION_UP
D/KeyboardView( 9835):  <TrimeInput>    onModifiedTouchEvent()  onModifiedTouchEvent
D/KeyboardView( 9835): swipeDebug.onModifiedTouchEvent before gesture, action = UP
D/KeyboardView( 9835): swipeDebug.onModifiedTouchEvent mGestureDetector.onTouchEvent(me) = fall & action_up
D/KeyboardView( 9835): swipeDebug.ext fail, dX=0, dY=0
D/KeyboardView( 9835):  <TrimeInput>    invalidateKey() keyIndex=32, mKeysExist=true
I/KeyboardView( 9835): onBufferDraw() keyCount=33, drawSingleKey=true, invalidKeyIsNull=false
D/Keyboard( 9835):  <TrimeInput>    keyState() ctrl=false, alt=false, shift=false, sym=false, meta=false    onBufferDraw, drawSingleKey=true
D/KeyboardView( 9835):  <TrimeInput>    invalidateKey() invalidate
D/KeyboardView( 9835):  <TrimeInput>    invalidateKey() finish
D/KeyboardView( 9835):  <TrimeInput>    onModifiedTouchEvent()  detectAndSendKey
D/KeyboardView( 9835):  <TrimeInput>    detectAndSendKey()  index=32, x=1009, y=560, type=5, mKeys.length=33
D/KeyboardView( 9835):  <TrimeInput>    detectAndSendKey()  onEvent, code=66, key.getEvent
D/Keyboard( 9835):  <TrimeInput>    keyState() ctrl=false, alt=false, shift=false, sym=false, meta=false, state=0   keyEventCode=66
D/Event   ( 9835): <Event> getRimeEvent()   code=66, mask=0, name=Return    output key=65293, meta=0
I/rime.trime( 9835): updated option: soft_cursor
D/Rime    ( 9835): Handling Rime notification: OptionEvent(option=soft_cursor, value=true)
I/Rime    ( 9835):  <TrimeInput>    getContexts() get_context
I/Rime    ( 9835):  <TrimeInput>    getContexts() getStatus
I/Rime    ( 9835):  <TrimeInput>    getContexts() finish
D/KeyboardView( 9835):  <TrimeInput>    invalidateAllKeys()
I/rime.trime( 9835): updated option: _horizontal
D/Rime    ( 9835): Handling Rime notification: OptionEvent(option=_horizontal, value=true)
I/Rime    ( 9835):  <TrimeInput>    getContexts() get_context
I/Rime    ( 9835):  <TrimeInput>    getContexts() getStatus
I/Rime    ( 9835):  <TrimeInput>    getContexts() finish
D/KeyboardView( 9835):  <TrimeInput>    invalidateAllKeys()
I/Rime    ( 9835):  <TrimeInput>    onkey() keycode=65293, mask=0
I/Rime    ( 9835):  <TrimeInput>    onkey() keycode=65293, mask=0, process_key result=false
I/Rime    ( 9835):  <TrimeInput>    getContexts() get_context
I/Rime    ( 9835):  <TrimeInput>    getContexts() getStatus
I/Rime    ( 9835):  <TrimeInput>    getContexts() finish
I/Rime    ( 9835):  <TrimeInput>    onkey() finish
I/EditorInstance( 9835):    <TrimeInput>    commitRimeText()    updateComposing
D/Trime   ( 9835): updateComposing() SymbolKeyboardType=NO_KEY
D/Composition( 9835): setWindow Rime.getComposition(), [1]com.osfans.trime.ime.text.Composition.setWindow(Composition.java:536), [2]com.osfans.trime.ime.core.Trime.updateComposing(Trime.java:1215), [3]com.osfans.trime.ime.core.EditorInstance.commitRimeText(EditorInstance.kt:60)
I/ScrollView( 9835): ScroolView move(0 0), scroll=0
I/KeyboardView( 9835): onBufferDraw() keyCount=33, drawSingleKey=false, invalidKeyIsNull=true
D/Keyboard( 9835):  <TrimeInput>    keyState() ctrl=false, alt=false, shift=false, sym=false, meta=false    onBufferDraw, drawSingleKey=false
**D/Keyboard( 9835):    <TrimeInput>    keyState() ctrl=false, alt=false, shift=false, sym=false, meta=false    getCurrentDrawableState() Key=Shift states=3 on=false isShifted=false pressed=false sticky=false**
D/KeyboardView( 9835): onBufferDraw() keyBackground==null, key=Shift
D/Trime   ( 9835):  <TrimeInput>    handleKey() EnterOrHide, keycode=66
D/KeyboardView( 9835):  <TrimeInput>    releaseKey() key=66, mComboCount=0, mComboMode=false
D/Event   ( 9835): <Event> getRimeEvent()   code=66, mask=1073741824, name=Return   output key=65293, meta=1073741824
D/TextInputManager( 9835):  <TrimeInput>    onRelease() needSendUpRimeKey=false, keyEventcode=66, Event.getRimeEvent=[I@a68bb7e
D/TextInputManager( 9835):  <TrimeInput>    onRelease() finish
D/KeyboardView( 9835):  <TrimeInput>    releaseKey() finish
D/KeyboardView( 9835):  <TrimeInput>    detectAndSendKey()  refreshModifier
D/KeyboardView( 9835):  <TrimeInput>    detectAndSendKey()  finish
D/KeyboardView( 9835):  <TrimeInput>    onModifiedTouchEvent()  detectAndSendKey finish
D/KeyboardView( 9835):  <TrimeInput>    invalidateKey() keyIndex=32, mKeysExist=true
I/KeyboardView( 9835): onBufferDraw() keyCount=33, drawSingleKey=true, invalidKeyIsNull=false
D/Keyboard( 9835):  <TrimeInput>    keyState() ctrl=false, alt=false, shift=false, sym=false, meta=false    onBufferDraw, drawSingleKey=true
D/KeyboardView( 9835):  <TrimeInput>    invalidateKey() invalidate
D/KeyboardView( 9835):  <TrimeInput>    invalidateKey() finish
D/KeyboardView( 9835):  <TrimeInput>    onModifiedTouchEvent()  not actionDown done
W/RemoteInputConnection( 9835): getExtractedText() was cancelled.
D/Trime   ( 9835):  <TrimeInit> onWindowHidden  
D/Trime   ( 9835):  <TrimeInit> onWindowHidden  super finish
I/Trime   ( 9835): onWindowHidden...
D/Trime   ( 9835):  <TrimeInit> onWindowHidden  eventListeners
I/Trime   ( 9835): NotFullscreenMode
amalgame21 commented 1 year ago

当在termux的使用快捷键盘按下alt之后再按同文enter时是正常的。

Pressing Enter after pressing alt also register twice for my systems.

amalgame21 commented 1 year ago

Bump. This issue still exist in the latest 3.2.13 version. I am still sticking with the 3.2.9 version to avoid this issue (because 3.2.10 have another issue). Without fixing this issue, I will not upgrade and help test the latest version because I use termux with trime every day.