Add new APIs, peek selection and change page#620
Conversation
|
macOS build fails due to this |
Context:Peek
5672bb7 to
9aa83e6
Compare
| //! select a candidate at the given index in candidate list. | ||
| Bool (*select_candidate)(RimeSessionId session_id, size_t index); | ||
| //! peek a selection without commiting to it | ||
| Bool (*peek_candidate)(RimeSessionId session_id, size_t index); |
There was a problem hiding this comment.
把API放在struct中间会破坏ABI兼容性,新API应置于struct末尾。下同
我先嘗試把 squirrel 編譯過,現在第一步在 Sparkle 那裏出錯了。——給submodule升級解決 |
|
想就代碼變更討論兩點:
這個 PR 與其類似,但同時還改變了 我建議換用一個表示出發生這種變動的名字,如
|
lotem
left a comment
There was a problem hiding this comment.
I've got some time working on this PR, and I put my comments down for what changes I think are necessary.
| select_notifier_(this); | ||
| return true; | ||
| size_t new_index = index; | ||
| if (index < 0) { |
There was a problem hiding this comment.
index < 0 does not happen with size_t.
| size_t candidate_count = seg.menu->Prepare(index + 1); | ||
| if (index >= candidate_count) { | ||
| DLOG(INFO) << "selection index exceed candidate pool, fallback to last"; | ||
| new_index = candidate_count - 1; |
There was a problem hiding this comment.
The fallback feature is convenient in highlighting the candidate of the same label number in the next page.
But when called by Select(index), the given index means a definite candidate, and fallback is unexpected.
|
|
||
| bool Context::Select(size_t index) { | ||
| if (composition_.empty()) | ||
| bool result = Peek(index); |
There was a problem hiding this comment.
The fallback mechanism of Peek does not work for Select. See my other comment below.
Also, this creates a difference in the signaled notifications: an extra update_notifier_ is triggered before select_notifier_.
I think we'd better keep the two functions separate.
|
我正在改,再改改。 |
|
沒意見我就我按自己的愛好改咯。 |
|
Modified and merged as 142902d |
add function Context::Highlight Merges rime#620 Squashed commit of the following: commit bff5a89a8abb31c0ca612e42fe704cb8b522e2df Author: 居戎氏 <chen.sst@gmail.com> Date: Fri Feb 9 11:01:36 2024 +0800 rename the new function Context::Highlight do not re-use it in Context::Select commit fbc709e Author: 居戎氏 <chen.sst@gmail.com> Date: Thu Feb 8 23:03:43 2024 +0800 re-order API functions commit 0de4da0 Author: 居戎氏 <chen.sst@gmail.com> Date: Thu Feb 8 22:20:35 2024 +0800 fix: missing brackets in if-statement commit 5c1502e Author: LEO Yoon-Tsaw <leoyoontsaw@icloud.com> Date: Tue Feb 21 09:49:34 2023 -0500 Fix RECOMMENDED_MACOSX_DEPLOYMENT_TARGET error commit ecd3649 Author: LEO Yoon-Tsaw <leoyoontsaw@icloud.com> Date: Mon Feb 20 16:42:45 2023 -0500 Update context.cc commit 9aa83e6 Author: LEO Yoon-Tsaw <leoyoontsaw@icloud.com> Date: Sun Feb 19 23:56:17 2023 -0500 Add new APIs, peek selection and change page Context:Peek
Context:Peek
Pull request
Issue tracker
Partially addresses #616
Feature
Add 3 new APIs:
Unit test
Manual test
Code Review
Additional Info