From 4f37e9fd659840603e787bf2304b4f1ae4a94de4 Mon Sep 17 00:00:00 2001 From: yenharvey Date: Mon, 26 Oct 2026 11:28:47 +0800 Subject: [PATCH] =?UTF-8?q?feat(settings):=20=E6=96=B0=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E7=9A=84=E5=80=99=E9=80=89=E9=A1=B5=E5=8A=A0?= =?UTF-8?q?=E4=B8=8A=E5=B0=8F=E9=94=AE=E7=9B=98=E6=95=B0=E5=AD=97=EF=BC=88?= =?UTF-8?q?Windows=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #354 只接了旧版 Windows 设置;新设置程序是主入口,按平台支持表只在 Windows 显示,macOS、Linux 记为待实现。文档同步到按键页与设置页。 --- apps/settings/src/docs.rs | 6 +++++ apps/settings/src/support/mod.rs | 8 ++++++- apps/settings/src/view/pages/candidates.rs | 22 +++++++++++++++++-- docs/plan/todo.md | 1 + docs/user/getting-started/keys.md | 2 ++ docs/user/getting-started/settings.md | 2 +- docs/user/i18n/en/getting-started/keys.md | 2 ++ docs/user/i18n/en/getting-started/settings.md | 2 +- 8 files changed, 40 insertions(+), 5 deletions(-) diff --git a/apps/settings/src/docs.rs b/apps/settings/src/docs.rs index f034a408..c080418d 100644 --- a/apps/settings/src/docs.rs +++ b/apps/settings/src/docs.rs @@ -31,6 +31,12 @@ const LINKS: &[(PageId, &str, &str, &str)] = &[ (PageId::Input, "笔画", "input/aux-code", "码表"), (PageId::Input, "导入码表", "input/aux-code", "码表"), (PageId::Candidates, "译文", "learning/translation", "译词"), + ( + PageId::Candidates, + "小键盘数字", + "getting-started/keys", + "打拼音时", + ), (PageId::Candidates, "输出字形", "input/traditional", "开启"), ( PageId::Candidates, diff --git a/apps/settings/src/support/mod.rs b/apps/settings/src/support/mod.rs index e8c99109..c6e636d6 100644 --- a/apps/settings/src/support/mod.rs +++ b/apps/settings/src/support/mod.rs @@ -44,11 +44,13 @@ pub enum Feature { ShowTones, /// 「实验功能」页:下载、启用知意与含章·知微。 ExperimentalModels, + /// 中文组句中的小键盘数字:选候选还是进组句。 + NumpadDigit, } impl Feature { #[cfg(test)] - pub const ALL: [Self; 20] = [ + pub const ALL: [Self; 21] = [ Self::AuxCode, Self::Schemes, Self::SwitchKeys, @@ -69,6 +71,7 @@ impl Feature { Self::KeyHint, Self::ShowTones, Self::ExperimentalModels, + Self::NumpadDigit, ]; /// 当前平台显示这一项。 @@ -116,6 +119,7 @@ impl Feature { Self::ShowTones => [Yes, Yes, Todo], // Windows、Linux 的服务进程还没接知意;没有 GPU 时 CPU 上打分要发烫,先只开 macOS(Metal) Self::ExperimentalModels => [Yes, Yes, Todo], + Self::NumpadDigit => [Todo, Yes, Todo], } } @@ -143,6 +147,7 @@ impl Feature { Self::KeyHint => "双拼键位提示", Self::ShowTones => "拼音行显示声调", Self::ExperimentalModels => "实验功能(知意、含章·知微)", + Self::NumpadDigit => "小键盘数字", } } @@ -173,6 +178,7 @@ impl Feature { Self::VocabularyTranslation => &[(PageId::Cloud, "生词本整句翻译")], Self::KeyHint => &[(PageId::Input, "键位提示")], Self::ShowTones => &[(PageId::Candidates, "拼音行显示声调")], + Self::NumpadDigit => &[(PageId::Candidates, "小键盘数字")], Self::SystemCtrlSpace | Self::EnglishPunctuation | Self::StatusBar diff --git a/apps/settings/src/view/pages/candidates.rs b/apps/settings/src/view/pages/candidates.rs index 63a07764..a0649562 100644 --- a/apps/settings/src/view/pages/candidates.rs +++ b/apps/settings/src/view/pages/candidates.rs @@ -3,12 +3,12 @@ use bamboo_slip::taffy::NodeId; use bamboo_slip::{RenderError, SettingRow, Stepper, Ui, group, section_title}; use qingjian_core::{ENGLISH_CANDIDATES_MAX, LEARNING_LANGUAGES, TraditionalVariant}; -use qingjian_platform::{EmojiCount, MAX_PAGE_SIZE}; +use qingjian_platform::{EmojiCount, MAX_PAGE_SIZE, NumpadDigit}; use crate::message::{Message, Popup}; use crate::support::Feature; use crate::view::Page; -use crate::view::parts::controls::{select, toggle_info, toggle_with}; +use crate::view::parts::controls::{choice, select, toggle_info, toggle_with}; pub fn candidates(ui: &mut Ui, page: &Page) -> Result, RenderError> { let theme = &page.theme; @@ -72,6 +72,24 @@ pub fn candidates(ui: &mut Ui, page: &Page) -> Result, Rend general.learning_language_off(), )?, ]; + if Feature::NumpadDigit.here() { + let numpad = choice( + ui, + page, + "numpad-digit", + &NumpadDigit::ALL, + general.numpad_digit, + NumpadDigit::label, + |value| Message::set("general", "numpad_digit", value.key()), + )?; + rows.insert( + 1, + SettingRow::new("小键盘数字") + .info("组句中按小键盘数字") + .control(numpad) + .build(ui, theme)?, + ); + } if Feature::ShowTones.here() { rows.push(toggle_info( ui, diff --git a/docs/plan/todo.md b/docs/plan/todo.md index a15844ff..57657a67 100644 --- a/docs/plan/todo.md +++ b/docs/plan/todo.md @@ -157,6 +157,7 @@ - [ ] 双拼键位提示:Linux - [ ] 拼音行显示声调:Linux - [ ] 实验功能(知意、含章·知微):Linux + - [ ] 小键盘数字:macOS、Linux ## 四、其他输入方案 diff --git a/docs/user/getting-started/keys.md b/docs/user/getting-started/keys.md index 668cc16d..7d6e5e3b 100644 --- a/docs/user/getting-started/keys.md +++ b/docs/user/getting-started/keys.md @@ -44,6 +44,8 @@ Windows 与 Linux 的中 / 英切换键还可以选单击 `Ctrl` 或 `Ctrl + Alt | 进入辅码 | `;` | `;` | — | | 横排时展开成多行(需在设置中打开) | `↑` / `↓` | `↑` / `↓` | — | +Windows 上小键盘数字缺省也是选候选;在「设置 → 候选」把「小键盘数字」改成「直接输入数字」后,组句中按小键盘数字会把数字接在敲的字母后面,跟着一起上屏(`wenti` 再按小键盘 `5`、空格,得到 `wenti5`),主键盘数字照旧选候选。要开着 Num Lock。 + 光标停在拼音中间时,候选只按光标之前的拼音计算(`ni|hao` 出「你」);上屏后其余拼音保留,光标移到末尾。 大千注音与五笔下有几个键不同,见 [拼音方案与模糊音](../input/fuzzy-and-shuangpin.md#大千注音) 与 [五笔与混输](../input/wubi.md)。 diff --git a/docs/user/getting-started/settings.md b/docs/user/getting-started/settings.md index 1207617a..b187378c 100644 --- a/docs/user/getting-started/settings.md +++ b/docs/user/getting-started/settings.md @@ -22,7 +22,7 @@ description: 打开设置的方法、搜索与 ⓘ 说明、设置窗口 12 页 | 页 | 内容 | 详见 | |---|---|---| | 输入 | 拼音方案(全拼、双拼、注音)、形码(五笔)、分次选词、键位提示、模糊音、辅码 | [拼音方案与模糊音](../input/fuzzy-and-shuangpin.md)、[五笔与混输](../input/wubi.md)、[辅码](../input/aux-code.md) | -| 候选 | 每页候选数、学习语言、词性、繁体、拼音带声调、emoji 与符号、学习输入习惯、本地整句模型、英文词 | [候选旁的译词](../learning/translation.md)、[繁体输出](../input/traditional.md)、[整句、简拼与纠错](../input/sentence.md) | +| 候选 | 每页候选数、小键盘数字(Windows)、学习语言、词性、繁体、拼音带声调、emoji 与符号、学习输入习惯、本地整句模型、英文词 | [候选旁的译词](../learning/translation.md)、[繁体输出](../input/traditional.md)、[整句、简拼与纠错](../input/sentence.md) | | 中英文 | 英文模式、切换键、默认模式、按应用记住、英文候选、标点、自动空格、悬浮状态条 | [中英文](../input/english-mode.md)、[标点、符号与表情](../input/punctuation.md) | | 外观 | 主题、深浅色、横排竖排、拼音位置、字体与字号、动画 | [外观与主题](../personalize/appearance.md) | | 快捷键 | 翻页键、高亮移动键、前缀字母、译词的修饰键、翻译与 AI 联想的快捷键 | [改按键](../personalize/keys-settings.md) | diff --git a/docs/user/i18n/en/getting-started/keys.md b/docs/user/i18n/en/getting-started/keys.md index 549fc6ca..a5600e33 100644 --- a/docs/user/i18n/en/getting-started/keys.md +++ b/docs/user/i18n/en/getting-started/keys.md @@ -44,6 +44,8 @@ On Windows and Linux, the Chinese / English switch can also be a tap of `Ctrl` o | Enter auxiliary code | `;` | `;` | — | | Expand to several rows in horizontal layout (enable in Settings) | `↑` / `↓` | `↑` / `↓` | — | +On Windows, numpad digits also pick candidates by default. Set 小键盘数字 (Numpad digits) under 设置 → 候选 (Settings → Candidates) to 直接输入数字 (Type digits) and numpad digits typed while composing are appended to the letters and committed with them (`wenti`, then numpad `5` and `Space`, gives `wenti5`); the main keyboard digits still pick candidates. Num Lock must be on. + When the cursor is in the middle of the pinyin, candidates are based only on the pinyin before the cursor (`ni|hao` gives 你); after committing, the rest of the pinyin stays and the cursor moves to the end. A few keys differ with Dachen Zhuyin and Wubi; see [Pinyin schemes and fuzzy pinyin](../input/fuzzy-and-shuangpin.md#Dachen-Zhuyin) and [Wubi and mixed input](../input/wubi.md). diff --git a/docs/user/i18n/en/getting-started/settings.md b/docs/user/i18n/en/getting-started/settings.md index e5d0c801..e913144b 100644 --- a/docs/user/i18n/en/getting-started/settings.md +++ b/docs/user/i18n/en/getting-started/settings.md @@ -24,7 +24,7 @@ Settings that exist only on some platforms are hidden on the others; settings th | Page | Contents | Details | |---|---|---| | 输入 (Input) | Pinyin scheme (full pinyin, double pinyin, Zhuyin), shape-based input (Wubi), picking in steps, key hints, fuzzy pinyin, auxiliary code | [Pinyin schemes and fuzzy pinyin](../input/fuzzy-and-shuangpin.md), [Wubi and mixed input](../input/wubi.md), [Auxiliary code](../input/aux-code.md) | -| 候选 (Candidates) | Candidates per page, learning language, part of speech, Traditional Chinese, pinyin with tones, emoji and symbols, learning your habits, local sentence model, English words | [Glosses beside candidates](../learning/translation.md), [Traditional Chinese output](../input/traditional.md), [Sentences, abbreviations and correction](../input/sentence.md) | +| 候选 (Candidates) | Candidates per page, numpad digits (Windows), learning language, part of speech, Traditional Chinese, pinyin with tones, emoji and symbols, learning your habits, local sentence model, English words | [Glosses beside candidates](../learning/translation.md), [Traditional Chinese output](../input/traditional.md), [Sentences, abbreviations and correction](../input/sentence.md) | | 中英文 (Chinese/English) | English mode, switch key, default mode, remembering per app, English candidates, punctuation, automatic spaces, floating status bar | [Chinese and English](../input/english-mode.md), [Punctuation, symbols and emoji](../input/punctuation.md) | | 外观 (Appearance) | Theme, light/dark, horizontal/vertical layout, pinyin position, fonts and sizes, animation | [Appearance and themes](../personalize/appearance.md) | | 快捷键 (Shortcuts) | Paging keys, highlight keys, prefix letters, modifiers for glosses, shortcuts for translation and AI suggestions | [Changing keys](../personalize/keys-settings.md) |