Skip to content

Commit 0724ab7

Browse files
authored
Merge pull request #258 from naokiri/Issue#257
Fix issue#257. Add rule for composition selection and change input mo…
2 parents 9d96fd1 + 48d4d7c commit 0724ab7

File tree

6 files changed

+36
-2
lines changed

6 files changed

+36
-2
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ All notable changes to this project will be documented in this file.
77

88
## [Unreleased]
99

10+
### Fixed
11+
- rulesファイルに変換選択状態から変換を確定しつつAsciiモードや全角英数モードへ遷移する処理を追加。 (Github Issue#257)
12+
1013
## [3.1.2] - 2024-10-19
1114

1215
### Fixed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/rules/azik/rule.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -727,6 +727,8 @@ q = ["", "ん"]
727727
"C-h" = ["ConfirmComposition", "Delete"]
728728
"at" = ["ConfirmComposition", "ChangeInputMode(Katakana)"]
729729
"C-at" = ["ConfirmComposition", "ChangeInputMode(HankakuKatakana)"]
730+
"l" = ["ConfirmComposition", "ChangeInputMode(Ascii)"]
731+
"L" = ["ConfirmComposition", "ChangeInputMode(Zenkaku)"]
730732
[composition_selection.katakana]
731733
"Return" = ["ConfirmComposition"]
732734
"C-j" = ["ConfirmComposition"]
@@ -738,6 +740,8 @@ q = ["", "ん"]
738740
"C-h" = ["ConfirmComposition", "Delete"]
739741
"at" = ["ConfirmComposition", "ChangeInputMode(Hiragana)"]
740742
"C-at" = ["ConfirmComposition", "ChangeInputMode(HankakuKatakana)"]
743+
"l" = ["ConfirmComposition", "ChangeInputMode(Ascii)"]
744+
"L" = ["ConfirmComposition", "ChangeInputMode(Zenkaku)"]
741745
[composition_selection.hankakukatakana]
742746
"Return" = ["ConfirmComposition"]
743747
"C-j" = ["ConfirmComposition"]
@@ -749,6 +753,8 @@ q = ["", "ん"]
749753
"C-h" = ["ConfirmComposition", "Delete"]
750754
"at" = ["ConfirmComposition", "ChangeInputMode(Hiragana)"]
751755
"C-at" = ["ConfirmComposition", "ChangeInputMode(Katakana)"]
756+
"l" = ["ConfirmComposition", "ChangeInputMode(Ascii)"]
757+
"L" = ["ConfirmComposition", "ChangeInputMode(Zenkaku)"]
752758

753759
[completion.hiragana]
754760
"Return" = ["ConfirmComposition"]

assets/rules/default/rule.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,8 @@ zz = ["z", "っ"]
468468
"C-h" = ["ConfirmComposition", "Delete"]
469469
"q" = ["ConfirmComposition", "ChangeInputMode(Katakana)"]
470470
"C-q" = ["ConfirmComposition", "ChangeInputMode(HankakuKatakana)"]
471+
"l" = ["ConfirmComposition", "ChangeInputMode(Ascii)"]
472+
"L" = ["ConfirmComposition", "ChangeInputMode(Zenkaku)"]
471473
[composition_selection.katakana]
472474
"Return" = ["ConfirmComposition", "ChangeCompositionMode(Direct)"]
473475
"C-j" = ["ConfirmComposition", "ChangeCompositionMode(Direct)"]
@@ -480,6 +482,8 @@ zz = ["z", "っ"]
480482
"C-h" = ["ConfirmComposition", "Delete"]
481483
"q" = ["ConfirmComposition", "ChangeInputMode(Hiragana)"]
482484
"C-q" = ["ConfirmComposition", "ChangeInputMode(HankakuKatakana)"]
485+
"l" = ["ConfirmComposition", "ChangeInputMode(Ascii)"]
486+
"L" = ["ConfirmComposition", "ChangeInputMode(Zenkaku)"]
483487
[composition_selection.hankakukatakana]
484488
"Return" = ["ConfirmComposition", "ChangeCompositionMode(Direct)"]
485489
"C-j" = ["ConfirmComposition", "ChangeCompositionMode(Direct)"]
@@ -492,6 +496,8 @@ zz = ["z", "っ"]
492496
"C-h" = ["ConfirmComposition", "Delete"]
493497
"q" = ["ConfirmComposition", "ChangeInputMode(Hiragana)"]
494498
"C-q" = ["ConfirmComposition", "ChangeInputMode(Katakana)"]
499+
"l" = ["ConfirmComposition", "ChangeInputMode(Ascii)"]
500+
"L" = ["ConfirmComposition", "ChangeInputMode(Zenkaku)"]
495501

496502
[completion.hiragana]
497503
"Return" = ["ConfirmComposition"]

src/dictionary/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ fn get_all_candidates_inner(
204204
composite_key: &CompositeKey,
205205
is_numeric_re_lookup: bool,
206206
) -> Vec<Candidate> {
207-
let mut matched_numbers = vec![];
207+
let mut matched_numbers: Vec<String>;
208208

209209
let exact_match_candidates = get_candidates_in_order(dictionaries, &composite_key);
210210
let exact_match_candidates = dedup_candidates(exact_match_candidates);

tests/tests.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1490,3 +1490,22 @@ fn maruichi() {
14901490
}),
14911491
)
14921492
}
1493+
1494+
// Issue #257
1495+
#[test]
1496+
fn composition_select_with_command() {
1497+
init_test_logger();
1498+
let mut context = default_test_context();
1499+
transition_test(
1500+
&mut context,
1501+
CompositionMode::Direct,
1502+
InputMode::Hiragana,
1503+
"H e n k a n space l",
1504+
CompositionMode::Direct,
1505+
InputMode::Ascii,
1506+
CskkStateInfo::Direct(DirectData {
1507+
confirmed: "変換".to_string(),
1508+
unconverted: None,
1509+
}),
1510+
);
1511+
}

0 commit comments

Comments
 (0)