dsh模块、快捷键调整

This commit is contained in:
zhongluofeng committed 2026-09-28 18:05:29 +08:00
1 parent ff1d5cd517
commit 7e65825d3e
54 files changed
+7082 -109

No files matched your search

+15 -2
View File
@@ -190,7 +190,7 @@ impl Default for TranslateEngineConfig {
pub struct SelectionSettings {
/// 总开关:打开翻译面板时是否尝试读取当前划词作为候选
pub enabled: bool,
/// 打开翻译面板的全局快捷键(默认 Ctrl+2)
/// 打开翻译面板的全局快捷键(默认 Alt+F)
#[serde(default = "default_panel_shortcut")]
pub panel_shortcut: String,
/// 取词方式:
@@ -209,7 +209,7 @@ pub struct SelectionSettings {
}
fn default_panel_shortcut() -> String {
"Ctrl+2".to_string()
"Alt+F".to_string()
}
impl Default for SelectionSettings {
@@ -427,6 +427,19 @@ impl TranslateSettings {
self.version = 2;
changed = true;
}
// v2 → v3:翻译面板默认快捷键从 Ctrl+2 改为 Alt+F(把 Ctrl+数字 让给终端)。
// 仍等于旧默认值 = 用户没改过,直接迁移;改过或已清空的原样保留。
if self.version < 3 {
if self.selection
.panel_shortcut
.trim()
.eq_ignore_ascii_case("ctrl+2")
{
self.selection.panel_shortcut = default_panel_shortcut();
}
self.version = 3;
changed = true;
}
changed
}
}