From 365897a83c74e08e0356252e8784eb5ee79d10ad Mon Sep 17 00:00:00 2001 From: Shawn Wang Date: Sun, 22 Dec 2024 10:20:56 +0800 Subject: [PATCH] add basic PinyinVariant info --- src/editor/zhuyin_layout/hsu.rs | 9 +++++++++ src/editor/zhuyin_layout/pinyin.rs | 11 +++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/editor/zhuyin_layout/hsu.rs b/src/editor/zhuyin_layout/hsu.rs index a4ba5dd7..c3f9d940 100644 --- a/src/editor/zhuyin_layout/hsu.rs +++ b/src/editor/zhuyin_layout/hsu.rs @@ -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 { diff --git a/src/editor/zhuyin_layout/pinyin.rs b/src/editor/zhuyin_layout/pinyin.rs index c1f680c7..5734553e 100644 --- a/src/editor/zhuyin_layout/pinyin.rs +++ b/src/editor/zhuyin_layout/pinyin.rs @@ -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,