Skip to content

Commit

Permalink
Fix #529
Browse files Browse the repository at this point in the history
Choseong converted into jongseong even `TreatJongseongAsChoseong` is off
  • Loading branch information
Riey committed Oct 3, 2021
1 parent fa8dba0 commit 563f946
Showing 1 changed file with 27 additions and 12 deletions.
39 changes: 27 additions & 12 deletions src/engine/backends/hangul/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,14 @@ impl CharacterState {
..Default::default()
}),
}
} else if let Some(_) = self.jong {
// $ㅁ + ㅏ = ㅁㅏ
// 초성없이 중성과 종성만 있는 경우를 배제
CharacterResult::NewCharacter(Self {
jung: Some(jung),
compose_jung,
..Default::default()
})
} else {
self.jung = Some(jung);
self.compose_jung = compose_jung;
Expand All @@ -391,19 +399,26 @@ impl CharacterState {
None => {
let new;

match jong.to_cho(addons) {
JongToCho::Direct(cho) => {
new = Self {
cho: Some(cho),
..Default::default()
};
}
JongToCho::Compose(..) => {
new = Self {
jong: Some(jong),
..Default::default()
};
if addons.contains(Addon::TreatJongseongAsChoseong) {
match jong.to_cho(addons) {
JongToCho::Direct(cho) => {
new = Self {
cho: Some(cho),
..Default::default()
};
}
JongToCho::Compose(..) => {
new = Self {
jong: Some(jong),
..Default::default()
};
}
}
} else {
new = Self {
jong: Some(jong),
..Default::default()
};
}

CharacterResult::NewCharacter(new)
Expand Down

0 comments on commit 563f946

Please sign in to comment.