Skip to content
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

Change symbol candidate tab with the space bar #7

Open
yanganto opened this issue Sep 30, 2021 · 19 comments
Open

Change symbol candidate tab with the space bar #7

yanganto opened this issue Sep 30, 2021 · 19 comments

Comments

@yanganto
Copy link

Once the candidate window is open, the space bar will change the candidate tab, but not to choose the candidate words.

Here is the expectation
w11 -> ,
w1 space 1 -> …
w1 space -> ( nothing output and the candidate window will be the tab starts with … )

This is the current result
w11 -> ,
w1 space -> ,

@lotem
Copy link
Member

lotem commented Oct 2, 2021

I'm not familiar with Array IME.
@archerindigo can you comment on this?

The described behaviour looks like special logic from other Array IME software. Is that a crucial feature?
Rime tries to implement it using common input logic found in most Chinese IMEs, and the goal is not to create a 100% clone of existing solutions.

@yanganto
Copy link
Author

yanganto commented Oct 2, 2021

This is part of the symbol input of Array30, because there are more than 10 symbols in each type. We need to use space bar to switch the symbol combination tabs.

In current behavior, there is no way to switch the symbol combination tabs by keyboard (the arrow keys does not work). The way to work around is clicking arrows by mouse.

Thank @archerindigo to bring the correct symbol combination tab for rime-array, and we almost there. I am really appreciated this, and I will test more on rime-array. Thanks. :)

@archerindigo
Copy link
Contributor

This is part of the symbol input of Array30, because there are more than 10 symbols in each type. We need to use space bar to switch the symbol combination tabs.

In current behavior, there is no way to switch the symbol combination tabs by keyboard (the arrow keys does not work). The way to work around is clicking arrows by mouse.

Thank @archerindigo to bring the correct symbol combination tab for rime-array, and we almost there. I am really appreciated this, and I will test more on rime-array. Thanks. :)

Currently you can use the common rime logic (page up/ page down) to switch pages.

Sorry I am currently on vacation and will look deeper into this few days later.

@lotem
Copy link
Member

lotem commented Oct 5, 2021

Now I understand the issue better.
The space key is equivalent to page down function in the context of entering array symbols. I don't know if space key is also used to show the next page of candidates when entering Chinese characters, as in PC Zhuyin IME. If this function is only bound to symbols starting with w[digit], then this feature isn't feasible as Rime doesn't yet support modal input, that is to say the space key cannot perform different actions (select the top character candidate vs. go to next page of symbol candidates) depending on the content.

Give the default key binding a try. Instead of the space key,
use Page_Up / Page_Down, or - / =.
You can also bind other key to Page_Up if it isn't otherwise useful; the digit keys' neighbour - Tab is a good choice.

@yanganto
Copy link
Author

yanganto commented Oct 6, 2021

This is not a specific feature for w[digit] of Array input method, and also for the normal mode of Array input method.

Furthermore, using space bar to switch the candidates tab is really general for traditional Chinese input methods.

At least following OS + IME use space bar to change the candidates tab:

  • windows + Changjie
  • mac + build in Zhuyin
  • mac + OpenVanilla - Changjie
  • mac + OpenVanilla - Array
  • Linux + Hime

I think one of the reason, to use 1 to 0 for candidates selection and space bar to change the candidate tab,
is less hand movement and better key efficiency. Besides, the PageDown and PageUp may in different place with different device, and the space bar, and 1 to 0 key are less change place in different device.
Such that if people really consider the speed of typing, they will likely use space to change the candidates tab.

I really enjoy both your work on Rime and Rime-Array.
May you consider add an option in RIME for using space to switch candidates tab?
Please consider this, many thanks.

@archerindigo
Copy link
Contributor

For entering Chinese characters, it is unnecessary to use spacebar to show next page of candidates because of the low redundant rate of Array. In fact, the current spacebar behavior improves efficiency to choose the first candidate.

For array symbol input (currently as affix array30_wsymbols), indeed using spacebar to show next page of candidates is better and it is the behavior of many other Array input method on other IMEs.

So the objective is: to override spacebar behavior when array30 calls array30_wsymbols.

It is quite easy to override the spacebar behavior by using key_binder

key_binder:
  bindings:
    - { when: has_menu, accept: space, send: Page_Down }

However, if we put this key binding in array30_wsymbols.schema.yaml, it won't take effect when array30 calls array30_wsymbols.

I'm not sure whether it is supported to let the main input (array30) method to respect the key_binder options set in the secondary method (array30_wsymbols) when the main method calls it out. To my understanding, only segmentors and translators of the secondary method would be respected. @lotem can you clarify this a bit?

@yanganto
Copy link
Author

yanganto commented Oct 7, 2021

Thanks @archerindigo to provide a way to solve this, and there is something I want to clarify.

For entering Chinese characters, it is unnecessary to use spacebar to show next page of candidates because of the low redundant rate of Array. In fact, the current spacebar behavior improves efficiency to choose the first candidate.

Array is by default using space bar to switch the candidates tabs, and if there still be redundant candidates more than ten, but in really rare case.
We can check out the web archive to see the last question from the original Array website, there are always issues on different IME lack space bar change candidates tab features. lol
http://web.archive.org/web/20171014170800/http://www.array.com.tw/BOX/BOX2.htm#NTrtdisp

If it is possible to make space bar to change candidate by option, and everything will become wonderful. 😄

@lotem
Copy link
Member

lotem commented Oct 7, 2021

I'm not sure whether it is supported to let the main input (array30) method to respect the key_binder options set in the secondary method (array30_wsymbols) when the main method calls it out. To my understanding, only segmentors and translators of the secondary method would be respected. @lotem can you clarify this a bit?

OK. This comment is for explaining how the input schema dependencies work.

When the engine is loaded with array30.schema.yaml, it doesn't use any component defined under array30_wsymbols.schema.yaml:/engine. It only uses the dictionary files array30_wsymbols.*.bin, and the file array30_wsymbols.schema.yaml is only used to generate these .bin files, if you never use it as the main IME.
In the above scenario, only these YAML lines are necessary:

schema:
  schema_id: array30_wsymbols
  name: "行列30 W+數字符號組"
  version: "1.0"

translator:
  dictionary: array30_wsymbols
  prism: array30_wsymbols

Since we already have the other parts, lets keep them for testing purpose, to run array30_wsymbols as a standalone IME when needed.

The configuration that actually takes effect is all here:
https://github.com/rime/rime-array/blob/master/array30.schema.yaml
The behaviour of the wsymbols feature as a secondary IME is all defined in this config file.

There are two techniques for overriding the main configuration to get different behaviours.

1. reusable patch

Write the config diffs in a YAML file, and refer to it in array30.custom.yaml:/patch, or use the __patch directive.

2. a new config that extends the main input schema

Write the config diffs in a new input schema, and __include the main input schema (array30.schema.yaml) for not repeating the common part.

Note:__include and __patch are add-on grammar supported by Rime's YAML parser.
https://github.com/rime/home/wiki/Configuration#%E8%AA%9E%E6%B3%95

The following example illustrates both techniques:
https://github.com/rime/rime-bopomofo/blob/master/bopomofo_tw.schema.yaml

@lotem
Copy link
Member

lotem commented Oct 7, 2021

This is the acurate solution to using space bar for the next page:
#7 (comment)

Undoubtedly, the dedicated Page_Down/Page_Up are natually for changing page of candidates in any context, software.

For best efficiency, different software provides different solutions. PC IMEs like Microsoft Zhuyin uses the space key to toggle through pages of candidates; I believe this practice is first found in Japanese IMEs. But these practices are not necessarily followed in other IME software especially in the mobile version. Most of the popular Pinyin IMEs chose , ., which is easy to use for any IMEs that use only letter keys to encode.

The choice of the non-encoding keys and how they behave is not part of the IME design when speaking of Array, Cangjie, etc; it's more of a choice of the IME software. This is my personal view.

Keys for editing and selecting candidate make a part of the user's muscle memory. For that reason they have better be consistent for users of multiple IMEs. For the same reason, IME platforms should also consider implementing consistent default key binding for most IMEs.
Rime provides the flexibility to configure key bindings separately with a patch config. Example:
https://github.com/rime/home/wiki/CustomizationGuide#%E4%BB%A5%E6%96%B9%E6%8B%AC%E8%99%9F%E9%8D%B5%E6%8F%9B%E9%A0%81

Patches that change the common key binding can be used as a feature diagonal to input schema.
I refuse to assume those who use a Rime input schema are users of a particular software. More often, Rime users
expect common functions among different IMEs be realized with the same keys. This should also be the case when, for example, a traditional Array IME user switching to Pinyin or Wubi want to keep the space-as-next-page convention.

@archerindigo
Copy link
Contributor

Thanks for the explanation. To conclude, it is not very feasible to change the behavior of spacebar only for typing w[digit] symbols while using Array.

Instead one can change the key binding for the whole Array method. One simple way is to add a patch file array30.custom.yaml under the user directory with the following content:

patch:
  key_binder:
    import_preset: default
    bindings:
      - { when: paging, accept: comma, send: comma }
      - { when: has_menu, accept: period, send: period }
      - { when: has_menu, accept: space, send: Page_Down }

No change to the current source is required.

@lotem
Copy link
Member

lotem commented Oct 7, 2021

More consisely add a new key binding:

# array30.custom.yaml
patch:
  key_binder/bindings/+:
    - { when: has_menu, accept: space, send: Page_Down }

@yanganto
Copy link
Author

yanganto commented Oct 8, 2021

The custom yaml config with patch setting works perfect. Thanks a lot.

@yanganto yanganto closed this as completed Oct 8, 2021
@yanganto
Copy link
Author

yanganto commented Oct 9, 2021

I apologize and sorry about that the issue is closed without fully testing.

There are some other issues with before configures, and the solution is not fix the problem perfectly, such that I reopen the issue.

If I use the config aforementioned. The word with exactly selection can not be chosen.

The expected output
j c space → 你

The output with previous config
There is no word output, and the candidates tab move to page 2.

The selection logic of Array

  • j c space → the output candidates are j c exactly combination.
If there is only one word in this combination, the word will go out directly, 
     and the candidates' tab will not show,
else (there are more than one words with this exactly combination)
    the candidates' tab show up (then the `space` can use to change the candidates' tab)
  • j c → the candidates' tab are combinations starts with j c and nothing out until space or 1 to 0 key in

@yanganto yanganto reopened this Oct 9, 2021
@archerindigo
Copy link
Contributor

  1. j + c is also the exact short code for and , and also more candidates to come with more keys to type. Thus, in rime cannot be regarded as the unique candidate in this combination.

  2. Once you bind space to Page_down in the when condition has_menu, you will no longer able to select candidate with spacebar.

I don't remember in bindings there exist a when condition which can cover the case "only when the menu has multiple pages". If it exists, your problem can be improved. @lotem may give a comment regarding this.

@yanganto
Copy link
Author

yanganto commented Oct 9, 2021

1. `j` + `c` is also the exact short code for `瞠` and `眇`, and also more candidates to come with more keys to type. Thus, in rime `你` cannot be regarded as the unique candidate in this combination.

This is not correct, we can look up the key code here
The exact combination is only (because this is a special code, I pretty sure that)
j + c + space

Others are prefix combination not the exactly one, and the number keys are the shortcut to select some words which has next key in the column.
j + c + j + r + space or j + c + 7 (the 7 is the shortcut for u, j, or m)
j + c + l + space or j + c + 9 (the 9 is the shortcut for o, l, or .)

By the way, this is the beautiful design of Array. People always can look the candidate's order to learn how to type quick or to guess the exactly key code for some words.

@archerindigo
Copy link
Contributor

Ok. I think you're referring to the special code handling. Special code in rime-array are arranged as the first candidate in menu. Unlike some other IMEs like gcin, Windows, which hide them from candidate menu and handle them specially. Therefore, you still have to retain the original binding of space in order to select them with space.

The number position of short-code is also currently not handled due to a number of reasons.

If you care about the special-code and short-code handling more than the menu page switching with space, you may have a try to another more advanced modification Onion Array30.

@yanganto
Copy link
Author

yanganto commented Oct 9, 2021

Thanks @archerindigo, I will try to connect the author of Onion Array30, and if he is willing to share his configure, I will make a PR to fix this.

@lotem
Copy link
Member

lotem commented Oct 10, 2021

The selection logic of Array

  • j c space → the output candidates are j c exactly combination.

That counterdicts your previous statement:

Array is by default using space bar to switch the candidates tabs

That was why I thought it was important to ask if space is used for different functions depending on context.
In that case it's not supported at the moment. In order to get the perfect behaviour you probably want to

  1. define the exact behaviour under all possible conditions in a requirement document;
  2. write a Rime plugin to implement the defined logic.

@yanganto
Copy link
Author

yanganto commented Oct 10, 2021

@lotem

Yes, now I know the different context meaning, I just summarize the condition and help people to learn more if someone is interested in this issue.

There are two context.

  • combination undefined (still key in)
  • combination defined

In Array, the space and 1 to 0 are used to change the undefined state to the defined state.
Once there is only one word for the defined combination, the word will output directly and no candidates' tab shown.
In the other hand, the candidate tabs shown, and the space is the default switching key.

It is true that space has two meaning, one is changing the undefined state to a defined state, other is switching the candidates' tab.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants