-
Notifications
You must be signed in to change notification settings - Fork 570
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add new APIs, peek selection and change page #620
Conversation
macOS build fails due to this
|
Context:Peek
5672bb7
to
9aa83e6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
目前鼠须管master分支依赖该PR,导致build不便,鼠须管主线也无法直接更新到librime 1.9,因此非常希望该PR尽早合并,或至少把依赖该PR的鼠须管代码移除、另作PR。
@lotem comments?
src/rime_api.h
Outdated
@@ -524,6 +524,8 @@ typedef struct rime_api_t { | |||
|
|||
//! 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
把API放在struct中间会破坏ABI兼容性,新API应置于struct末尾。下同
我先嘗試把 squirrel 編譯過,現在第一步在 Sparkle 那裏出錯了。——給submodule升級解決 |
想就代碼變更討論兩點:
這個 PR 與其類似,但同時還改變了 我建議換用一個表示出發生這種變動的名字,如
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
@@ -110,17 +110,35 @@ void Context::Clear() { | |||
} | |||
|
|||
bool Context::Select(size_t index) { | |||
if (composition_.empty()) | |||
bool result = Peek(index); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
我正在改,再改改。 |
沒意見我就我按自己的愛好改咯。 |
add function Context::Highlight Merges rime#620 Squashed commit of the following: commit bff5a89a8abb31c0ca612e42fe704cb8b522e2df Author: 居戎氏 <[email protected]> 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: 居戎氏 <[email protected]> Date: Thu Feb 8 23:03:43 2024 +0800 re-order API functions commit 0de4da0 Author: 居戎氏 <[email protected]> Date: Thu Feb 8 22:20:35 2024 +0800 fix: missing brackets in if-statement commit 5c1502e Author: LEO Yoon-Tsaw <[email protected]> Date: Tue Feb 21 09:49:34 2023 -0500 Fix RECOMMENDED_MACOSX_DEPLOYMENT_TARGET error commit ecd3649 Author: LEO Yoon-Tsaw <[email protected]> Date: Mon Feb 20 16:42:45 2023 -0500 Update context.cc commit 9aa83e6 Author: LEO Yoon-Tsaw <[email protected]> Date: Sun Feb 19 23:56:17 2023 -0500 Add new APIs, peek selection and change page Context:Peek
Modified and merged as 142902d |
add function Context::Highlight Merges rime#620 Squashed commit of the following: commit bff5a89a8abb31c0ca612e42fe704cb8b522e2df Author: 居戎氏 <[email protected]> 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: 居戎氏 <[email protected]> Date: Thu Feb 8 23:03:43 2024 +0800 re-order API functions commit 0de4da0 Author: 居戎氏 <[email protected]> Date: Thu Feb 8 22:20:35 2024 +0800 fix: missing brackets in if-statement commit 5c1502e Author: LEO Yoon-Tsaw <[email protected]> Date: Tue Feb 21 09:49:34 2023 -0500 Fix RECOMMENDED_MACOSX_DEPLOYMENT_TARGET error commit ecd3649 Author: LEO Yoon-Tsaw <[email protected]> Date: Mon Feb 20 16:42:45 2023 -0500 Update context.cc commit 9aa83e6 Author: LEO Yoon-Tsaw <[email protected]> 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