Skip to content

Commit

Permalink
Merge pull request #258 from naokiri/Issue#257
Browse files Browse the repository at this point in the history
Fix issue#257. Add rule for composition selection and change input mo…
  • Loading branch information
naokiri authored Jan 19, 2025
2 parents 9d96fd1 + 48d4d7c commit 0724ab7
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions assets/rules/azik/rule.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand All @@ -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"]
Expand All @@ -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"]
Expand Down
6 changes: 6 additions & 0 deletions assets/rules/default/rule.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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)"]
Expand All @@ -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)"]
Expand All @@ -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"]
Expand Down
2 changes: 1 addition & 1 deletion src/dictionary/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ fn get_all_candidates_inner(
composite_key: &CompositeKey,
is_numeric_re_lookup: bool,
) -> Vec<Candidate> {
let mut matched_numbers = vec![];
let mut matched_numbers: Vec<String>;

let exact_match_candidates = get_candidates_in_order(dictionaries, &composite_key);
let exact_match_candidates = dedup_candidates(exact_match_candidates);
Expand Down
19 changes: 19 additions & 0 deletions tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}),
);
}

0 comments on commit 0724ab7

Please sign in to comment.