-
Notifications
You must be signed in to change notification settings - Fork 573
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
highlight candidate (selection without committance) #650
Conversation
你需要的是fluid_editor吧? |
No. It's for mouse hoover. |
a30967e
to
b05e719
Compare
peek is a horrible function name choice… |
d9791d8
to
91a241d
Compare
return false; | ||
int selected_index = comp.back().selected_index; | ||
int page_start = (selected_index / page_size) * page_size; | ||
// hilite an already hilited candidate -> select this candidate |
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.
It's quite hidden logic. The function should do exactly what the name implies.
if (page_start + index == selected_index) | ||
return ctx->Select(selected_index); | ||
comp.back().selected_index = page_start + index; | ||
comp.back().tags.insert("paging"); |
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.
Highlighting a candidate does not necessarily change page.
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.
Highlighting a candidate does not necessarily change page.
But this is consistent with the behavior of navigators—even if there's no turning pages, user is no longer actively composing which means paging keys should take priority over composing keys (e.g. in the case of ,
and .
).
@@ -149,7 +149,8 @@ ProcessResult Selector::ProcessKeyEvent(const KeyEvent& key_event) { | |||
else if (ch >= XK_KP_0 && ch <= XK_KP_9) | |||
index = ((ch - XK_KP_0) + 9) % 10; | |||
if (index >= 0) { | |||
SelectCandidateAt(ctx, index); | |||
key_event.alt() ? HiliteCandidateAt(ctx, 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.
I'm not in favour of this feature. Why would user want to do that with a key combo?
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'm not in favour of this feature. Why would user want to do that with a key combo?
because, when intended to be followed by deleting the candidate, it's faster to use a key combo to jump from highlighting candidate 1 to highlighting candidate 10 than press down/right key 9 times, provided that user does not want to use mouse.
@@ -121,6 +121,20 @@ bool Context::Select(size_t index) { | |||
return false; | |||
} | |||
|
|||
bool Context::Hilite(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.
Let's spell it Highlight
.
It's one of the option I suggested in Leo's PR.
I would probably took his PR with some modifications.
@@ -635,6 +638,10 @@ typedef struct rime_api_t { | |||
const char* option_name, | |||
Bool state); | |||
|
|||
Bool (*hilite_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.
Inserting new members breaks ABI compatibility.
Don't.
Append new members to the end instead.
Pull request
Allow users to
choose
a candidate -- selection without committance, serving as shortcuts forselect
by multiple consecutive navigators. By default, this also enablesAlt + select_key
aschoose
whereasselect_key
remains asselect
.Issue tracker
Fixes will automatically close the related issue
Fixes #
Feature
Describe feature of pull request
Unit test
Manual test
Code Review
Additional Info