Skip to content

Commit

Permalink
add basic PinyinVariant info
Browse files Browse the repository at this point in the history
  • Loading branch information
shawn111 committed Dec 26, 2024
1 parent 786b0ff commit 365897a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
9 changes: 9 additions & 0 deletions src/editor/zhuyin_layout/hsu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ impl Hsu {
syllable: Default::default(),
}
}

///
/// tone key is hsu_end_key
/// KeyCode::S -> Bopomofo::TONE5
/// KeyCode::D -> Bopomofo::TONE2
/// KeyCode::F -> Bopomofo::TONE3
/// KeyCode::J -> Bopomofo::TONE4
/// KeyCode::Space -> Bopomofo::TONE1
///
fn is_hsu_end_key(&self, key: KeyEvent) -> bool {
// TODO allow customize end key mapping
match key.code {
Expand Down
11 changes: 7 additions & 4 deletions src/editor/zhuyin_layout/pinyin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,19 @@ const MAX_PINYIN_LEN: usize = 10;
/// TODO: docs
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]
pub enum PinyinVariant {
/// TODO: docs
/// [Hanyu Pinyin](https://en.wikipedia.org/wiki/Pinyin), or simply pinyin
#[default]
HanyuPinyin,
/// TODO: docs
/// [THL, Taíwan Huáyǔ Luómǎ Pinyin](https://pinyin.thl.tw/)
ThlPinyin,
/// TODO: docs
/// [MPS2, Mandarin Phonetic Symbols II](https://pinyin.info/romanization/mps2)
Mps2Pinyin,
}

/// TODO: docs
/// Pinyin
///
/// Current support types: [`PinyinVariant`](enum@PinyinVariant)
///
#[derive(Default, Debug, Clone)]
pub struct Pinyin {
key_seq: String,
Expand Down

0 comments on commit 365897a

Please sign in to comment.