From 48d4d7c5d449a0b9890da9deab0f5757234f7777 Mon Sep 17 00:00:00 2001 From: Naoaki Iwakiri Date: Fri, 17 Jan 2025 16:00:26 +0900 Subject: [PATCH] Fix issue#257. Add rule for composition selection and change input mode to latin --- CHANGELOG.md | 3 +++ Cargo.lock | 2 +- assets/rules/azik/rule.toml | 6 ++++++ assets/rules/default/rule.toml | 6 ++++++ src/dictionary/mod.rs | 2 +- tests/tests.rs | 19 +++++++++++++++++++ 6 files changed, 36 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6171697..d259d7c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ All notable changes to this project will be documented in this file. ## [Unreleased] +### Fixed +- rulesファイルに変換選択状態から変換を確定しつつAsciiモードや全角英数モードへ遷移する処理を追加。 (Github Issue#257) + ## [3.1.2] - 2024-10-19 ### Fixed diff --git a/Cargo.lock b/Cargo.lock index 80cc70f..8471e2b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -524,7 +524,7 @@ dependencies = [ [[package]] name = "cskk" -version = "3.1.1" +version = "3.1.2" dependencies = [ "anyhow", "bitflags 2.3.3", diff --git a/assets/rules/azik/rule.toml b/assets/rules/azik/rule.toml index 9ab7ed4..0b2b025 100644 --- a/assets/rules/azik/rule.toml +++ b/assets/rules/azik/rule.toml @@ -727,6 +727,8 @@ q = ["", "ん"] "C-h" = ["ConfirmComposition", "Delete"] "at" = ["ConfirmComposition", "ChangeInputMode(Katakana)"] "C-at" = ["ConfirmComposition", "ChangeInputMode(HankakuKatakana)"] +"l" = ["ConfirmComposition", "ChangeInputMode(Ascii)"] +"L" = ["ConfirmComposition", "ChangeInputMode(Zenkaku)"] [composition_selection.katakana] "Return" = ["ConfirmComposition"] "C-j" = ["ConfirmComposition"] @@ -738,6 +740,8 @@ q = ["", "ん"] "C-h" = ["ConfirmComposition", "Delete"] "at" = ["ConfirmComposition", "ChangeInputMode(Hiragana)"] "C-at" = ["ConfirmComposition", "ChangeInputMode(HankakuKatakana)"] +"l" = ["ConfirmComposition", "ChangeInputMode(Ascii)"] +"L" = ["ConfirmComposition", "ChangeInputMode(Zenkaku)"] [composition_selection.hankakukatakana] "Return" = ["ConfirmComposition"] "C-j" = ["ConfirmComposition"] @@ -749,6 +753,8 @@ q = ["", "ん"] "C-h" = ["ConfirmComposition", "Delete"] "at" = ["ConfirmComposition", "ChangeInputMode(Hiragana)"] "C-at" = ["ConfirmComposition", "ChangeInputMode(Katakana)"] +"l" = ["ConfirmComposition", "ChangeInputMode(Ascii)"] +"L" = ["ConfirmComposition", "ChangeInputMode(Zenkaku)"] [completion.hiragana] "Return" = ["ConfirmComposition"] diff --git a/assets/rules/default/rule.toml b/assets/rules/default/rule.toml index fccb2a0..19a2aa0 100644 --- a/assets/rules/default/rule.toml +++ b/assets/rules/default/rule.toml @@ -468,6 +468,8 @@ zz = ["z", "っ"] "C-h" = ["ConfirmComposition", "Delete"] "q" = ["ConfirmComposition", "ChangeInputMode(Katakana)"] "C-q" = ["ConfirmComposition", "ChangeInputMode(HankakuKatakana)"] +"l" = ["ConfirmComposition", "ChangeInputMode(Ascii)"] +"L" = ["ConfirmComposition", "ChangeInputMode(Zenkaku)"] [composition_selection.katakana] "Return" = ["ConfirmComposition", "ChangeCompositionMode(Direct)"] "C-j" = ["ConfirmComposition", "ChangeCompositionMode(Direct)"] @@ -480,6 +482,8 @@ zz = ["z", "っ"] "C-h" = ["ConfirmComposition", "Delete"] "q" = ["ConfirmComposition", "ChangeInputMode(Hiragana)"] "C-q" = ["ConfirmComposition", "ChangeInputMode(HankakuKatakana)"] +"l" = ["ConfirmComposition", "ChangeInputMode(Ascii)"] +"L" = ["ConfirmComposition", "ChangeInputMode(Zenkaku)"] [composition_selection.hankakukatakana] "Return" = ["ConfirmComposition", "ChangeCompositionMode(Direct)"] "C-j" = ["ConfirmComposition", "ChangeCompositionMode(Direct)"] @@ -492,6 +496,8 @@ zz = ["z", "っ"] "C-h" = ["ConfirmComposition", "Delete"] "q" = ["ConfirmComposition", "ChangeInputMode(Hiragana)"] "C-q" = ["ConfirmComposition", "ChangeInputMode(Katakana)"] +"l" = ["ConfirmComposition", "ChangeInputMode(Ascii)"] +"L" = ["ConfirmComposition", "ChangeInputMode(Zenkaku)"] [completion.hiragana] "Return" = ["ConfirmComposition"] diff --git a/src/dictionary/mod.rs b/src/dictionary/mod.rs index 6f02939..fd7ec4a 100644 --- a/src/dictionary/mod.rs +++ b/src/dictionary/mod.rs @@ -204,7 +204,7 @@ fn get_all_candidates_inner( composite_key: &CompositeKey, is_numeric_re_lookup: bool, ) -> Vec { - let mut matched_numbers = vec![]; + let mut matched_numbers: Vec; let exact_match_candidates = get_candidates_in_order(dictionaries, &composite_key); let exact_match_candidates = dedup_candidates(exact_match_candidates); diff --git a/tests/tests.rs b/tests/tests.rs index 550e96e..bf7fc7b 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -1490,3 +1490,22 @@ fn maruichi() { }), ) } + +// Issue #257 +#[test] +fn composition_select_with_command() { + init_test_logger(); + let mut context = default_test_context(); + transition_test( + &mut context, + CompositionMode::Direct, + InputMode::Hiragana, + "H e n k a n space l", + CompositionMode::Direct, + InputMode::Ascii, + CskkStateInfo::Direct(DirectData { + confirmed: "変換".to_string(), + unconverted: None, + }), + ); +}