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

Custom typing rule is not used during dict edit #49

Closed
lo48576 opened this Issue Jan 20, 2018 · 3 comments

Comments

Projects
None yet
2 participants
@lo48576
Copy link
Contributor

lo48576 commented Jan 20, 2018

Assume that using the keymap rule (keymap/default.json) below:

{
    "define": {
        "keymap": {
            "C-g": null,
            "C-c": "abort",
            "C-r": "abort",
            ...
        }
    }
}

Type "P o y o SPC", and you will see ▼ぽよ【】 appears.
Then:

  • If I pressed C-r, nothing happens.
  • If I pressed C-c, nothing happens.
  • If I pressed C-g, escaped dictionary edit (▽ぽよ appeared).

At ▽ぽよ state, C-g does nothing and both C-c and C-g work as expected (input cancelled).

Why C-g is treated specially?


Additional note in Japanese:
端的な説明: https://mastodon.cardina1.red/@lo48576/99383492999038223

#47, #48 を利用して "Escape": "abort-to-latin-passthrough" のように設定することで vi-cooperative にしたかったのですが、そもそも辞書登録状態で abort が期待したように動いてなさそうだったため issue を立てました。
私もコードを読んでみたのですが、 C-g をハードコーディングで特別扱いしている箇所は見付からなかったため、何故このような挙動になっているのかわかりませんでした。
何らかの仕掛けで、辞書登録時に "abort" コマンドでなく "C-g" キーのみが影響を及ぼすようになっているのでしょうか?

@lo48576 lo48576 changed the title `C-g` is treated specially while dict edit? `C-g` is treated specially during dict edit? Jan 20, 2018

@lo48576

This comment has been minimized.

Copy link
Contributor

lo48576 commented Jan 21, 2018

Rule I set by rom-kana seems not used during dict edit.
I think the problem is that the custom rule is not used during dict edit.

@lo48576

This comment has been minimized.

Copy link
Contributor

lo48576 commented Jan 21, 2018

libskk/libskk/context.vala

Lines 353 to 354 in afe959b

void start_dict_edit (string midasi, bool okuri) {
var state = new State (_dictionaries);

libskk/libskk/state.vala

Lines 132 to 142 in afe959b

internal State (Gee.List<Dict> dictionaries) {
this.dictionaries = dictionaries;
this.candidates = new SimpleCandidateList ();
this.candidates.selected.connect (candidate_selected);
rom_kana_converter = new RomKanaConverter ();
okuri_rom_kana_converter = new RomKanaConverter ();
auto_start_henkan_keywords = AUTO_START_HENKAN_KEYWORDS;
try {
_typing_rule = new Rule ("default");

When entering to dict edit mode, a new state is created and pushed, but the new state is created with default rule by default.
This seems to be causing the issue.

I'll write pull request to fix this soon.

@lo48576 lo48576 changed the title `C-g` is treated specially during dict edit? Custom typing rule is not used during dict edit Jan 21, 2018

@ueno

This comment has been minimized.

Copy link
Owner

ueno commented Jan 22, 2018

Right, thank you for investigating it. I guess the fix itself would be trivial (adding state.typing_rule = typing_rule in start_dict_edit), but it would be great if we have a test case too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment