librime icon indicating copy to clipboard operation
librime copied to clipboard

Recognizer input : insert ch in caret_pos

Open shewer opened this issue 2 years ago • 4 comments

Pull request

Issue tracker

Fixes will automatically close the related issue

Fixes # caret_pos 不在字尾時 ab^cd key : 'z' input = abcdz <--- 錯誤 ab^cd key: 'z' input = abzcd < -- 修正

Feature

Describe feature of pull request

Unit test

  • [ ] Done

Manual test

  • [ ] Done

Code Review

  1. Unit and manual test pass
  2. GitHub Action CI pass
  3. At least one contributor reviews and votes
  4. Can be merged clean without conflicts
  5. PR will be merged by rebase upstream base

Additional Info

shewer avatar Aug 15 '23 13:08 shewer

Question: does it work as expected after the fix?

After recognizer handled the pattern abzcd, the new inputabz^cd will probably not be given to matcher as abzcd but as abz, ending at cursor position.

lotem avatar Oct 15 '23 11:10 lotem

Question: does it work as expected after the fix?

After recognizer handled the pattern abzcd, the new inputabz^cd will probably not be given to matcher as abzcd but as abz, ending at cursor position.

原來的 recoginzer ab^cdz 變更後 recognizer 使用 abc^dz recoginzer 收下後 ctx._input = abz^cd compisition.input = abz

  • Compose() reset comp.input = abz https://github.com/rime/librime/blob/bcb3555d807f5601cbf0af85f98eb921921c2490/src/rime/engine.cc#L155-L157

-- matcher 使用 comp.input https://github.com/rime/librime/blob/bcb3555d807f5601cbf0af85f98eb921921c2490/src/rime/gear/matcher.cc#L26

這讓又產生一個疑問 recognizer patters 主要工作是確認 加入的 ch 是否在符合patterns 但是要比較 ctx._input 還是 ctx._input.substr(0, carte_pos) 才收下呢

從 Compose() 以後的 carte_pos 後的字串基本上是不管的

shewer avatar Oct 15 '23 15:10 shewer

我有點兒腦霧。理不清楚。不要緊以後再看。 用來解決什麼實際問題,有具體的例子嗎。

lotem avatar Feb 09 '24 09:02 lotem

一般正常輸入時 的確是 在 context.input 後面加上 字元,比較pattern 可是 當 caret_pos(^: caret_pos) 在 字串中間時 , active_input += ch 比較pattern 有點怪 abc^def 輸入z 應該 是 abcz^def 而不是 abc^defz

shewer avatar Feb 09 '24 10:02 shewer