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.
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.
Highlighting a candidate does not necessarily change page.
There was a problem hiding this comment.
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 .).
| 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.
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.
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.
| return false; | ||
| } | ||
|
|
||
| bool Context::Hilite(size_t index) { |
There was a problem hiding this comment.
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.
| const char* option_name, | ||
| Bool state); | ||
|
|
||
| Bool (*hilite_candidate)(RimeSessionId session_id, size_t index); |
There was a problem hiding this comment.
Inserting new members breaks ABI compatibility.
Don't.
Append new members to the end instead.
Pull request
Allow users to
choosea candidate -- selection without committance, serving as shortcuts forselectby multiple consecutive navigators. By default, this also enablesAlt + select_keyaschoosewhereasselect_keyremains 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