From 62ec90924595a703f5866876ba0a1b463dc48237 Mon Sep 17 00:00:00 2001 From: four-poetic-drew Date: Sat, 5 Jul 2025 14:16:07 +0800 Subject: [PATCH 1/9] Initial implementation of keyboard shortcuts list dialog --- src/bin/edit/draw_menubar.rs | 57 ++++++++++++++++++++++++++++++++++++ src/bin/edit/localization.rs | 17 +++++++++++ src/bin/edit/main.rs | 8 ++++- src/bin/edit/state.rs | 2 ++ 4 files changed, 83 insertions(+), 1 deletion(-) diff --git a/src/bin/edit/draw_menubar.rs b/src/bin/edit/draw_menubar.rs index 9fe8b7cefb63..80d6c6035c44 100644 --- a/src/bin/edit/draw_menubar.rs +++ b/src/bin/edit/draw_menubar.rs @@ -178,3 +178,60 @@ pub fn draw_dialog_about(ctx: &mut Context, state: &mut State) { state.wants_about = false; } } + +pub fn draw_keyboard_shortcuts_list(ctx: &mut Context, state: &mut State) { + ctx.modal_begin("Shortcuts", loc(LocId::KeyboardShortcutDialogTitle)); + { + ctx.block_begin("content"); + ctx.inherit_focus(); + ctx.attr_padding(Rect::three(1, 2, 1)); + { + ctx.label("title", "Keyboard Shortcuts"); + ctx.attr_position(Position::Center); + + // Define your shortcuts here: (description, shortcut) + let shortcuts = [ + ("New File", "Ctrl+N"), + ("Open File", "Ctrl+O"), + ("Save File", "Ctrl+S"), + ("Save As", "Ctrl+Shift+S"), + ("Close File", "Ctrl+W"), + ("Exit", "Ctrl+Q"), + ("Undo", "Ctrl+Z"), + ("Redo", "Ctrl+Y"), + ("Cut", "Ctrl+X"), + ("Copy", "Ctrl+C"), + ("Paste", "Ctrl+V"), + ("Find", "Ctrl+F"), + ("Replace", "Ctrl+R"), + ("Go To Line", "Ctrl+G"), + ("Select All", "Ctrl+A"), + // Add more as needed + ]; + + // Render each shortcut as a row + for (desc, key) in shortcuts.iter() { + ctx.block_begin("shortcut_row"); + ctx.label("shortcut_desc", desc); + ctx.label("shortcut_key", key); + ctx.block_end(); + } + + ctx.block_begin("choices"); + ctx.inherit_focus(); + ctx.attr_padding(Rect::three(1, 2, 0)); + ctx.attr_position(Position::Center); + { + if ctx.button("ok", loc(LocId::Ok), ButtonStyle::default()) { + state.wants_shortcuts_list = false; + } + ctx.inherit_focus(); + } + ctx.block_end(); + } + ctx.block_end(); + } + if ctx.modal_end() { + state.wants_shortcuts_list = false; + } +} diff --git a/src/bin/edit/localization.rs b/src/bin/edit/localization.rs index f42838625b6f..037f0ebb4e05 100644 --- a/src/bin/edit/localization.rs +++ b/src/bin/edit/localization.rs @@ -48,6 +48,9 @@ pub enum LocId { Help, HelpAbout, + //Keyboard shortcuts dialog + KeyboardShortcutDialogTitle, + // Exit dialog UnsavedChangesDialogTitle, UnsavedChangesDialogDescription, @@ -959,6 +962,20 @@ const S_LANG_LUT: [[&str; LangId::Count as usize]; LocId::Count as usize] = [ /* zh_hans */ "文件已存在。要覆盖它吗?", /* zh_hant */ "檔案已存在。要覆蓋它嗎?", ], + //KeyboardShortcutsDialogTitle + [ + /* en */ "Keyboard Shortcuts", + /* de */ "Tastenkürzel", + /* es */ "Atajos de teclado", + /* fr */ "Raccourcis clavier", + /* it */ "Scorciatoie da tastiera", + /* ja */ "キーボードショートカット", + /* ko */ "키보드 단축키", + /* pt_br */ "Atalhos de teclado", + /* ru */ "Сочетания клавиш", + /* zh_hans */ "键盘快捷键", + /* zh_hant */ "鍵盤快速鍵", + ], ]; static mut S_LANG: LangId = LangId::en; diff --git a/src/bin/edit/main.rs b/src/bin/edit/main.rs index 39b218d78c85..262afa0a55b4 100644 --- a/src/bin/edit/main.rs +++ b/src/bin/edit/main.rs @@ -317,6 +317,9 @@ fn draw(ctx: &mut Context, state: &mut State) { if state.error_log_count != 0 { draw_error_log(ctx, state); } + if state.wants_shortcuts_list { + draw_keyboard_shortcuts_list(ctx, state); + } if let Some(key) = ctx.keyboard_input() { // Shortcuts that are not handled as part of the textarea, etc. @@ -347,7 +350,10 @@ fn draw(ctx: &mut Context, state: &mut State) { state.wants_search.focus = true; } else if key == vk::F3 { search_execute(ctx, state, SearchAction::Search); - } else { + } else if key == vk:: F1 { + state.wants_shortcuts_list=true; + } + else { return; } diff --git a/src/bin/edit/state.rs b/src/bin/edit/state.rs index a42d8c095739..bdefc750820b 100644 --- a/src/bin/edit/state.rs +++ b/src/bin/edit/state.rs @@ -164,6 +164,7 @@ pub struct State { pub wants_close: bool, pub wants_exit: bool, pub wants_goto: bool, + pub wants_shortcuts_list: bool, pub goto_target: String, pub goto_invalid: bool, @@ -209,6 +210,7 @@ impl State { wants_indentation_picker: false, wants_go_to_file: false, wants_about: false, + wants_shortcuts_list:false, wants_close: false, wants_exit: false, wants_goto: false, From 5b17157d77bbed47ca3034919802000be022c5e7 Mon Sep 17 00:00:00 2001 From: four-poetic-drew Date: Sat, 5 Jul 2025 14:53:05 +0800 Subject: [PATCH 2/9] Localisation of shortcuts descriptions --- src/bin/edit/draw_menubar.rs | 58 +++++--- src/bin/edit/localization.rs | 278 ++++++++++++++++++++++++++++++++++- 2 files changed, 314 insertions(+), 22 deletions(-) diff --git a/src/bin/edit/draw_menubar.rs b/src/bin/edit/draw_menubar.rs index 80d6c6035c44..246cae433f16 100644 --- a/src/bin/edit/draw_menubar.rs +++ b/src/bin/edit/draw_menubar.rs @@ -186,27 +186,49 @@ pub fn draw_keyboard_shortcuts_list(ctx: &mut Context, state: &mut State) { ctx.inherit_focus(); ctx.attr_padding(Rect::three(1, 2, 1)); { - ctx.label("title", "Keyboard Shortcuts"); ctx.attr_position(Position::Center); - // Define your shortcuts here: (description, shortcut) let shortcuts = [ - ("New File", "Ctrl+N"), - ("Open File", "Ctrl+O"), - ("Save File", "Ctrl+S"), - ("Save As", "Ctrl+Shift+S"), - ("Close File", "Ctrl+W"), - ("Exit", "Ctrl+Q"), - ("Undo", "Ctrl+Z"), - ("Redo", "Ctrl+Y"), - ("Cut", "Ctrl+X"), - ("Copy", "Ctrl+C"), - ("Paste", "Ctrl+V"), - ("Find", "Ctrl+F"), - ("Replace", "Ctrl+R"), - ("Go To Line", "Ctrl+G"), - ("Select All", "Ctrl+A"), - // Add more as needed + // File/Edit actions (use existing LocId) + (loc(LocId::EditCopy), "Ctrl+C"), + (loc(LocId::EditCut), "Ctrl+X"), + (loc(LocId::EditPaste), "Ctrl+V"), + (loc(LocId::EditUndo), "Ctrl+Z"), + (loc(LocId::EditRedo), "Ctrl+Y"), + (loc(LocId::EditRedo), "Ctrl+Shift+Z"), + (loc(LocId::EditFind), "Ctrl+F"), + (loc(LocId::EditReplace), "Ctrl+R"), + (loc(LocId::EditSelectAll), "Ctrl+A"), + (loc(LocId::FileNew), "Ctrl+N"), + (loc(LocId::FileOpen), "Ctrl+O"), + (loc(LocId::FileSave), "Ctrl+S"), + (loc(LocId::FileSaveAs), "Ctrl+Shift+S"), + (loc(LocId::FileClose), "Ctrl+W"), + (loc(LocId::FileExit), "Ctrl+Q"), + (loc(LocId::FileGoto), "Ctrl+G"), + // Navigation and selection + (loc(LocId::ShortcutMoveCursorLeftWord), "Ctrl+Left Arrow"), + (loc(LocId::ShortcutMoveCursorRightWord), "Ctrl+Right Arrow"), + (loc(LocId::ShortcutMoveToDocStart), "Ctrl+Home"), + (loc(LocId::ShortcutMoveToDocEnd), "Ctrl+End"), + (loc(LocId::ShortcutSelectLeftWord), "Ctrl+Shift+Left Arrow"), + (loc(LocId::ShortcutSelectRightWord), "Ctrl+Shift+Right Arrow"), + (loc(LocId::ShortcutSelectLineStart), "Shift+Home"), + (loc(LocId::ShortcutSelectLineEnd), "Shift+End"), + (loc(LocId::ShortcutSelectDocStart), "Ctrl+Shift+Home"), + (loc(LocId::ShortcutSelectDocEnd), "Ctrl+Shift+End"), + (loc(LocId::ShortcutSelectLine), "Ctrl+L"), + // Editing + (loc(LocId::ShortcutDeletePrevWord), "Ctrl+Backspace"), + (loc(LocId::ShortcutDeleteNextWord), "Ctrl+Delete"), + (loc(LocId::ShortcutPasteShiftInsert), "Shift+Insert"), + (loc(LocId::ShortcutCopyCtrlInsert), "Ctrl+Insert"), + (loc(LocId::ShortcutCutShiftDelete), "Shift+Delete"), + // Word wrap + (loc(LocId::ViewWordWrap), "Alt+Z"), + // macOS word navigation + (loc(LocId::ShortcutMoveCursorLeftWordMac), "Alt+B"), + (loc(LocId::ShortcutMoveCursorRightWordMac), "Alt+F"), ]; // Render each shortcut as a row diff --git a/src/bin/edit/localization.rs b/src/bin/edit/localization.rs index 037f0ebb4e05..3e4fc46f3b3b 100644 --- a/src/bin/edit/localization.rs +++ b/src/bin/edit/localization.rs @@ -48,9 +48,6 @@ pub enum LocId { Help, HelpAbout, - //Keyboard shortcuts dialog - KeyboardShortcutDialogTitle, - // Exit dialog UnsavedChangesDialogTitle, UnsavedChangesDialogDescription, @@ -94,6 +91,27 @@ pub enum LocId { FileOverwriteWarning, FileOverwriteWarningDescription, + // Keyboard shortcuts dialog + KeyboardShortcutDialogTitle, + ShortcutMoveCursorLeftWord, + ShortcutMoveCursorRightWord, + ShortcutMoveToDocStart, + ShortcutMoveToDocEnd, + ShortcutSelectLeftWord, + ShortcutSelectRightWord, + ShortcutSelectLineStart, + ShortcutSelectLineEnd, + ShortcutSelectDocStart, + ShortcutSelectDocEnd, + ShortcutSelectLine, + ShortcutDeletePrevWord, + ShortcutDeleteNextWord, + ShortcutPasteShiftInsert, + ShortcutCopyCtrlInsert, + ShortcutCutShiftDelete, + ShortcutMoveCursorLeftWordMac, + ShortcutMoveCursorRightWordMac, + Count, } @@ -953,7 +971,7 @@ const S_LANG_LUT: [[&str; LangId::Count as usize]; LocId::Count as usize] = [ /* en */ "File already exists. Do you want to overwrite it?", /* de */ "Datei existiert bereits. Möchten Sie sie überschreiben?", /* es */ "El archivo ya existe. ¿Desea sobrescribirlo?", - /* fr */ "Le fichier existe déjà. Voulez-vous l’écraser ?", + /* fr */ "Le fichier существует déjà. Voulez-vous l’écraser ?", /* it */ "Il file esiste già. Vuoi sovrascriverlo?", /* ja */ "ファイルは既に存在します。上書きしますか?", /* ko */ "파일이 이미 존재합니다. 덮어쓰시겠습니까?", @@ -976,6 +994,258 @@ const S_LANG_LUT: [[&str; LangId::Count as usize]; LocId::Count as usize] = [ /* zh_hans */ "键盘快捷键", /* zh_hant */ "鍵盤快速鍵", ], + // ShortcutMoveCursorLeftWord + [ + /* en */ "Move cursor left by word", + /* de */ "Cursor wortweise nach links", + /* es */ "Mover cursor una palabra a la izquierda", + /* fr */ "Déplacer le curseur d’un mot à gauche", + /* it */ "Sposta cursore di una parola a sinistra", + /* ja */ "単語単位で左へ移動", + /* ko */ "단어 단위로 왼쪽 이동", + /* pt_br */ "Mover cursor uma palavra à esquerda", + /* ru */ "Переместить курсор на слово влево", + /* zh_hans */ "光标左移一词", + /* zh_hant */ "游標左移一詞", + ], + // ShortcutMoveCursorRightWord + [ + /* en */ "Move cursor right by word", + /* de */ "Cursor wortweise nach rechts", + /* es */ "Mover cursor una palabra a la derecha", + /* fr */ "Déplacer le curseur d’un mot à droite", + /* it */ "Sposta cursore di una parola a destra", + /* ja */ "単語単位で右へ移動", + /* ko */ "단어 단위로 오른쪽 이동", + /* pt_br */ "Mover cursor uma palavra à direita", + /* ru */ "Переместить курсор на слово вправо", + /* zh_hans */ "光标右移一词", + /* zh_hant */ "游標右移一詞", + ], + // ShortcutMoveToDocStart + [ + /* en */ "Move to start of document", + /* de */ "Zum Dokumentanfang", + /* es */ "Ir al inicio del documento", + /* fr */ "Aller au début du document", + /* it */ "Vai all’inizio del documento", + /* ja */ "ドキュメントの先頭へ移動", + /* ko */ "문서 처음으로 이동", + /* pt_br */ "Ir para o início do documento", + /* ru */ "В начало документа", + /* zh_hans */ "移到文档开头", + /* zh_hant */ "移至文件開頭", + ], + // ShortcutMoveToDocEnd + [ + /* en */ "Move to end of document", + /* de */ "Zum Dokumentende", + /* es */ "Ir al final del documento", + /* fr */ "Aller à la fin du document", + /* it */ "Vai alla fine del documento", + /* ja */ "ドキュメントの末尾へ移動", + /* ko */ "문서 끝으로 이동", + /* pt_br */ "Ir para o final do documento", + /* ru */ "В конец документа", + /* zh_hans */ "移到文档结尾", + /* zh_hant */ "移至文件結尾", + ], + // ShortcutSelectLeftWord + [ + /* en */ "Select left by word", + /* de */ "Wortweise nach links auswählen", + /* es */ "Seleccionar una palabra a la izquierda", + /* fr */ "Sélectionner d’un mot à gauche", + /* it */ "Seleziona una parola a sinistra", + /* ja */ "単語単位で左を選択", + /* ko */ "단어 단위로 왼쪽 선택", + /* pt_br */ "Selecionar uma palavra à esquerda", + /* ru */ "Выделить слово влево", + /* zh_hans */ "按词选择左侧", + /* zh_hant */ "按詞選取左側", + ], + // ShortcutSelectRightWord + [ + /* en */ "Select right by word", + /* de */ "Wortweise nach rechts auswählen", + /* es */ "Seleccionar una palabra a la derecha", + /* fr */ "Sélectionner d’un mot à droite", + /* it */ "Seleziona una parola a destra", + /* ja */ "単語単位で右を選択", + /* ko */ "단어 단위로 오른쪽 선택", + /* pt_br */ "Selecionar uma palavra à direita", + /* ru */ "Выделить слово вправо", + /* zh_hans */ "按词选择右侧", + /* zh_hant */ "按詞選取右側", + ], + // ShortcutSelectLineStart + [ + /* en */ "Select to start of line", + /* de */ "Bis zum Zeilenanfang auswählen", + /* es */ "Seleccionar hasta el inicio de la línea", + /* fr */ "Sélectionner jusqu’au début de la ligne", + /* it */ "Seleziona fino all’inizio della riga", + /* ja */ "行頭まで選択", + /* ko */ "줄 시작까지 선택", + /* pt_br */ "Selecionar até o início da linha", + /* ru */ "Выделить до начала строки", + /* zh_hans */ "选择到行首", + /* zh_hant */ "選取到行首", + ], + // ShortcutSelectLineEnd + [ + /* en */ "Select to end of line", + /* de */ "Bis zum Zeilenende auswählen", + /* es */ "Seleccionar hasta el final de la línea", + /* fr */ "Sélectionner jusqu’à la fin de la ligne", + /* it */ "Seleziona fino alla fine della riga", + /* ja */ "行末まで選択", + /* ko */ "줄 끝까지 선택", + /* pt_br */ "Selecionar até o final da linha", + /* ru */ "Выделить до конца строки", + /* zh_hans */ "选择到行尾", + /* zh_hant */ "選取到行尾", + ], + // ShortcutSelectDocStart + [ + /* en */ "Select to start of document", + /* de */ "Bis zum Dokumentanfang auswählen", + /* es */ "Seleccionar hasta el inicio del documento", + /* fr */ "Sélectionner jusqu’au début du document", + /* it */ "Seleziona fino all’inizio del documento", + /* ja */ "ドキュメントの先頭まで選択", + /* ko */ "문서 처음까지 선택", + /* pt_br */ "Selecionar até o início do documento", + /* ru */ "Выделить до начала документа", + /* zh_hans */ "选择到文档开头", + /* zh_hant */ "選取到文件開頭", + ], + // ShortcutSelectDocEnd + [ + /* en */ "Select to end of document", + /* de */ "Bis zum Dokumentende auswählen", + /* es */ "Seleccionar hasta el final del documento", + /* fr */ "Sélectionner jusqu’à la fin du document", + /* it */ "Seleziona fino alla fine del documento", + /* ja */ "ドキュメントの末尾まで選択", + /* ko */ "문서 끝까지 선택", + /* pt_br */ "Selecionar até o final do documento", + /* ru */ "Выделить до конца документа", + /* zh_hans */ "选择到文档结尾", + /* zh_hant */ "選取到文件結尾", + ], + // ShortcutSelectLine + [ + /* en */ "Select line", + /* de */ "Zeile auswählen", + /* es */ "Seleccionar línea", + /* fr */ "Sélectionner la ligne", + /* it */ "Seleziona riga", + /* ja */ "行を選択", + /* ko */ "줄 선택", + /* pt_br */ "Selecionar linha", + /* ru */ "Выделить строку", + /* zh_hans */ "选择行", + /* zh_hant */ "選取行", + ], + // ShortcutDeletePrevWord + [ + /* en */ "Delete previous word", + /* de */ "Vorheriges Wort löschen", + /* es */ "Eliminar palabra anterior", + /* fr */ "Supprimer le mot précédent", + /* it */ "Elimina la parola precedente", + /* ja */ "前の単語を削除", + /* ko */ "이전 단어 삭제", + /* pt_br */ "Excluir palavra anterior", + /* ru */ "Удалить предыдущее слово", + /* zh_hans */ "删除前一个词", + /* zh_hant */ "刪除前一詞", + ], + // ShortcutDeleteNextWord + [ + /* en */ "Delete next word", + /* de */ "Nächstes Wort löschen", + /* es */ "Eliminar palabra siguiente", + /* fr */ "Supprimer le мот suivant", + /* it */ "Elimina la parola successiva", + /* ja */ "次の単語を削除", + /* ko */ "다음 단어 삭제", + /* pt_br */ "Excluir próxima palavra", + /* ru */ "Удалить следующее слово", + /* zh_hans */ "删除下一个词", + /* zh_hant */ "刪除下一詞", + ], + // ShortcutPasteShiftInsert + [ + /* en */ "Paste", + /* de */ "Einfügen", + /* es */ "Pegar", + /* fr */ "Coller", + /* it */ "Incolla", + /* ja */ "貼り付け", + /* ko */ "붙여넣기", + /* pt_br */ "Colar", + /* ru */ "Вставить", + /* zh_hans */ "粘贴", + /* zh_hant */ "貼上", + ], + // ShortcutCopyCtrlInsert + [ + /* en */ "Copy", + /* de */ "Kopieren", + /* es */ "Copiar", + /* fr */ "Copier", + /* it */ "Copia", + /* ja */ "コピー", + /* ko */ "복사", + /* pt_br */ "Copiar", + /* ru */ "Копировать", + /* zh_hans */ "复制", + /* zh_hant */ "複製", + ], + // ShortcutCutShiftDelete + [ + /* en */ "Cut", + /* de */ "Ausschneiden", + /* es */ "Cortar", + /* fr */ "Couper", + /* it */ "Taglia", + /* ja */ "切り取り", + /* ko */ "잘라내기", + /* pt_br */ "Cortar", + /* ru */ "Вырезать", + /* zh_hans */ "剪切", + /* zh_hant */ "剪下", + ], + // ShortcutMoveCursorLeftWordMac + [ + /* en */ "Move cursor left by word (macOS)", + /* de */ "Cursor wortweise nach links (macOS)", + /* es */ "Mover cursor una palabra a la izquierda (macOS)", + /* fr */ "Déplacer le curseur d’un mot à gauche (macOS)", + /* it */ "Sposta cursore di una parola a sinistra (macOS)", + /* ja */ "単語単位で左へ移動 (macOS)", + /* ko */ "단어 단위로 왼쪽 이동 (macOS)", + /* pt_br */ "Mover cursor uma palavra à esquerda (macOS)", + /* ru */ "Переместить курсор на слово влево (macOS)", + /* zh_hans */ "光标左移一词 (macOS)", + /* zh_hant */ "游標左移一詞 (macOS)", + ], + // ShortcutMoveCursorRightWordMac + [ + /* en */ "Move cursor right by word (macOS)", + /* de */ "Cursor wortweise nach rechts (macOS)", + /* es */ "Mover cursor una palabra a la derecha (macOS)", + /* fr */ "Déplacer le curseur d’un mot à droite (macOS)", + /* it */ "Sposta cursore di una parola a destra (macOS)", + /* ja */ "単語単位で右へ移動 (macOS)", + /* ko */ "단어 단위로 오른쪽 이동 (macOS)", + /* pt_br */ "Mover cursor uma palavra à direita (macOS)", + /* ru */ "Переместить курсор на слово вправо (macOS)", + /* zh_hans */ "光标右移一词 (macOS)", + /* zh_hant */ "游標右移一詞 (macOS)", + ], ]; static mut S_LANG: LangId = LangId::en; From 37da785714dd682de5ddda4cb62841068d9fbc50 Mon Sep 17 00:00:00 2001 From: four-poetic-drew Date: Sat, 5 Jul 2025 15:04:27 +0800 Subject: [PATCH 3/9] WIP --- src/bin/edit/draw_menubar.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bin/edit/draw_menubar.rs b/src/bin/edit/draw_menubar.rs index 246cae433f16..9f4dbb7d3200 100644 --- a/src/bin/edit/draw_menubar.rs +++ b/src/bin/edit/draw_menubar.rs @@ -188,7 +188,7 @@ pub fn draw_keyboard_shortcuts_list(ctx: &mut Context, state: &mut State) { { ctx.attr_position(Position::Center); - let shortcuts = [ + let shortcuts: [(&'static str, &'static str); 35] = [ // File/Edit actions (use existing LocId) (loc(LocId::EditCopy), "Ctrl+C"), (loc(LocId::EditCut), "Ctrl+X"), From 7ba644016eca8d2d0399246083b87bc07c1ddaef Mon Sep 17 00:00:00 2001 From: four-poetic-drew Date: Sat, 5 Jul 2025 17:17:26 +0800 Subject: [PATCH 4/9] Removed non-working shortcuts from list --- src/bin/edit/draw_menubar.rs | 67 +++----- src/bin/edit/localization.rs | 300 +++-------------------------------- 2 files changed, 43 insertions(+), 324 deletions(-) diff --git a/src/bin/edit/draw_menubar.rs b/src/bin/edit/draw_menubar.rs index 9f4dbb7d3200..b090dcf96e11 100644 --- a/src/bin/edit/draw_menubar.rs +++ b/src/bin/edit/draw_menubar.rs @@ -188,56 +188,31 @@ pub fn draw_keyboard_shortcuts_list(ctx: &mut Context, state: &mut State) { { ctx.attr_position(Position::Center); - let shortcuts: [(&'static str, &'static str); 35] = [ - // File/Edit actions (use existing LocId) - (loc(LocId::EditCopy), "Ctrl+C"), - (loc(LocId::EditCut), "Ctrl+X"), - (loc(LocId::EditPaste), "Ctrl+V"), - (loc(LocId::EditUndo), "Ctrl+Z"), - (loc(LocId::EditRedo), "Ctrl+Y"), - (loc(LocId::EditRedo), "Ctrl+Shift+Z"), - (loc(LocId::EditFind), "Ctrl+F"), - (loc(LocId::EditReplace), "Ctrl+R"), - (loc(LocId::EditSelectAll), "Ctrl+A"), - (loc(LocId::FileNew), "Ctrl+N"), - (loc(LocId::FileOpen), "Ctrl+O"), - (loc(LocId::FileSave), "Ctrl+S"), - (loc(LocId::FileSaveAs), "Ctrl+Shift+S"), - (loc(LocId::FileClose), "Ctrl+W"), - (loc(LocId::FileExit), "Ctrl+Q"), - (loc(LocId::FileGoto), "Ctrl+G"), - // Navigation and selection - (loc(LocId::ShortcutMoveCursorLeftWord), "Ctrl+Left Arrow"), - (loc(LocId::ShortcutMoveCursorRightWord), "Ctrl+Right Arrow"), - (loc(LocId::ShortcutMoveToDocStart), "Ctrl+Home"), - (loc(LocId::ShortcutMoveToDocEnd), "Ctrl+End"), - (loc(LocId::ShortcutSelectLeftWord), "Ctrl+Shift+Left Arrow"), - (loc(LocId::ShortcutSelectRightWord), "Ctrl+Shift+Right Arrow"), - (loc(LocId::ShortcutSelectLineStart), "Shift+Home"), - (loc(LocId::ShortcutSelectLineEnd), "Shift+End"), - (loc(LocId::ShortcutSelectDocStart), "Ctrl+Shift+Home"), - (loc(LocId::ShortcutSelectDocEnd), "Ctrl+Shift+End"), - (loc(LocId::ShortcutSelectLine), "Ctrl+L"), - // Editing - (loc(LocId::ShortcutDeletePrevWord), "Ctrl+Backspace"), - (loc(LocId::ShortcutDeleteNextWord), "Ctrl+Delete"), - (loc(LocId::ShortcutPasteShiftInsert), "Shift+Insert"), - (loc(LocId::ShortcutCopyCtrlInsert), "Ctrl+Insert"), - (loc(LocId::ShortcutCutShiftDelete), "Shift+Delete"), - // Word wrap - (loc(LocId::ViewWordWrap), "Alt+Z"), - // macOS word navigation - (loc(LocId::ShortcutMoveCursorLeftWordMac), "Alt+B"), - (loc(LocId::ShortcutMoveCursorRightWordMac), "Alt+F"), - ]; - - // Render each shortcut as a row + let shortcuts: [(&'static str, &'static str); 15] = [ + (loc(LocId::EditCopy), "Ctrl + C"), + (loc(LocId::EditCut), "Ctrl + X"), + (loc(LocId::EditPaste), "Ctrl + V"), + (loc(LocId::EditUndo), "Ctrl + Z"), + (loc(LocId::EditRedo), "Ctrl + Y"), + (loc(LocId::EditFind), "Ctrl + F"), + (loc(LocId::EditReplace), "Ctrl + R"), + (loc(LocId::EditSelectAll), "Ctrl + A"), + (loc(LocId::FileNew), "Ctrl + N"), + (loc(LocId::FileOpen), "Ctrl + O"), + (loc(LocId::FileSave), "Ctrl + S"), + (loc(LocId::FileClose), "Ctrl + W"), + (loc(LocId::FileExit), "Ctrl + Q"), + (loc(LocId::FileGoto), "Ctrl + G"), + (loc(LocId::ShortcutSelectLine), "Ctrl + L"), ]; + + ctx.table_begin("shortcuts_table"); + ctx.table_set_cell_gap(Size { width: (5), height: (0) }); for (desc, key) in shortcuts.iter() { - ctx.block_begin("shortcut_row"); + ctx.table_next_row(); ctx.label("shortcut_desc", desc); ctx.label("shortcut_key", key); - ctx.block_end(); } + ctx.table_end(); ctx.block_begin("choices"); ctx.inherit_focus(); diff --git a/src/bin/edit/localization.rs b/src/bin/edit/localization.rs index 3e4fc46f3b3b..62bacb9fab15 100644 --- a/src/bin/edit/localization.rs +++ b/src/bin/edit/localization.rs @@ -93,25 +93,7 @@ pub enum LocId { // Keyboard shortcuts dialog KeyboardShortcutDialogTitle, - ShortcutMoveCursorLeftWord, - ShortcutMoveCursorRightWord, - ShortcutMoveToDocStart, - ShortcutMoveToDocEnd, - ShortcutSelectLeftWord, - ShortcutSelectRightWord, - ShortcutSelectLineStart, - ShortcutSelectLineEnd, - ShortcutSelectDocStart, - ShortcutSelectDocEnd, ShortcutSelectLine, - ShortcutDeletePrevWord, - ShortcutDeleteNextWord, - ShortcutPasteShiftInsert, - ShortcutCopyCtrlInsert, - ShortcutCutShiftDelete, - ShortcutMoveCursorLeftWordMac, - ShortcutMoveCursorRightWordMac, - Count, } @@ -282,17 +264,17 @@ const S_LANG_LUT: [[&str; LangId::Count as usize]; LocId::Count as usize] = [ ], // FileOpen [ - /* en */ "Open File…", - /* de */ "Datei öffnen…", - /* es */ "Abrir archivo…", - /* fr */ "Ouvrir un fichier…", - /* it */ "Apri file…", - /* ja */ "ファイルを開く…", - /* ko */ "파일 열기…", - /* pt_br */ "Abrir arquivo…", - /* ru */ "Открыть файл…", - /* zh_hans */ "打开文件…", - /* zh_hant */ "開啟檔案…", + /* en */ "Open File", + /* de */ "Datei öffnen", + /* es */ "Abrir archivo", + /* fr */ "Ouvrir un fichier", + /* it */ "Apri file", + /* ja */ "ファイルを開く", + /* ko */ "파일 열기", + /* pt_br */ "Abrir arquivo", + /* ru */ "Открыть файл", + /* zh_hans */ "打开文件", + /* zh_hant */ "開啟檔案", ], // FileSave [ @@ -352,17 +334,17 @@ const S_LANG_LUT: [[&str; LangId::Count as usize]; LocId::Count as usize] = [ ], // FileGoto [ - /* en */ "Go to Line:Column…", - /* de */ "Gehe zu Zeile:Spalte…", - /* es */ "Ir a línea:columna…", - /* fr */ "Aller à la ligne:colonne…", - /* it */ "Vai a riga:colonna…", - /* ja */ "行:列へ移動…", - /* ko */ "행:열로 이동…", - /* pt_br */ "Ir para linha:coluna…", - /* ru */ "Перейти к строке:столбцу…", - /* zh_hans */ "转到行:列…", - /* zh_hant */ "跳至行:列…", + /* en */ "Go to Line:Column", + /* de */ "Gehe zu Zeile:Spalte", + /* es */ "Ir a línea:columna", + /* fr */ "Aller à la ligne:colonne", + /* it */ "Vai a riga:colonna", + /* ja */ "行:列へ移動", + /* ko */ "행:열로 이동", + /* pt_br */ "Ir para linha:coluna", + /* ru */ "Перейти к строке:столбцу", + /* zh_hans */ "转到行:列", + /* zh_hant */ "跳至行:列", ], // Edit (a menu bar item) @@ -993,146 +975,6 @@ const S_LANG_LUT: [[&str; LangId::Count as usize]; LocId::Count as usize] = [ /* ru */ "Сочетания клавиш", /* zh_hans */ "键盘快捷键", /* zh_hant */ "鍵盤快速鍵", - ], - // ShortcutMoveCursorLeftWord - [ - /* en */ "Move cursor left by word", - /* de */ "Cursor wortweise nach links", - /* es */ "Mover cursor una palabra a la izquierda", - /* fr */ "Déplacer le curseur d’un mot à gauche", - /* it */ "Sposta cursore di una parola a sinistra", - /* ja */ "単語単位で左へ移動", - /* ko */ "단어 단위로 왼쪽 이동", - /* pt_br */ "Mover cursor uma palavra à esquerda", - /* ru */ "Переместить курсор на слово влево", - /* zh_hans */ "光标左移一词", - /* zh_hant */ "游標左移一詞", - ], - // ShortcutMoveCursorRightWord - [ - /* en */ "Move cursor right by word", - /* de */ "Cursor wortweise nach rechts", - /* es */ "Mover cursor una palabra a la derecha", - /* fr */ "Déplacer le curseur d’un mot à droite", - /* it */ "Sposta cursore di una parola a destra", - /* ja */ "単語単位で右へ移動", - /* ko */ "단어 단위로 오른쪽 이동", - /* pt_br */ "Mover cursor uma palavra à direita", - /* ru */ "Переместить курсор на слово вправо", - /* zh_hans */ "光标右移一词", - /* zh_hant */ "游標右移一詞", - ], - // ShortcutMoveToDocStart - [ - /* en */ "Move to start of document", - /* de */ "Zum Dokumentanfang", - /* es */ "Ir al inicio del documento", - /* fr */ "Aller au début du document", - /* it */ "Vai all’inizio del documento", - /* ja */ "ドキュメントの先頭へ移動", - /* ko */ "문서 처음으로 이동", - /* pt_br */ "Ir para o início do documento", - /* ru */ "В начало документа", - /* zh_hans */ "移到文档开头", - /* zh_hant */ "移至文件開頭", - ], - // ShortcutMoveToDocEnd - [ - /* en */ "Move to end of document", - /* de */ "Zum Dokumentende", - /* es */ "Ir al final del documento", - /* fr */ "Aller à la fin du document", - /* it */ "Vai alla fine del documento", - /* ja */ "ドキュメントの末尾へ移動", - /* ko */ "문서 끝으로 이동", - /* pt_br */ "Ir para o final do documento", - /* ru */ "В конец документа", - /* zh_hans */ "移到文档结尾", - /* zh_hant */ "移至文件結尾", - ], - // ShortcutSelectLeftWord - [ - /* en */ "Select left by word", - /* de */ "Wortweise nach links auswählen", - /* es */ "Seleccionar una palabra a la izquierda", - /* fr */ "Sélectionner d’un mot à gauche", - /* it */ "Seleziona una parola a sinistra", - /* ja */ "単語単位で左を選択", - /* ko */ "단어 단위로 왼쪽 선택", - /* pt_br */ "Selecionar uma palavra à esquerda", - /* ru */ "Выделить слово влево", - /* zh_hans */ "按词选择左侧", - /* zh_hant */ "按詞選取左側", - ], - // ShortcutSelectRightWord - [ - /* en */ "Select right by word", - /* de */ "Wortweise nach rechts auswählen", - /* es */ "Seleccionar una palabra a la derecha", - /* fr */ "Sélectionner d’un mot à droite", - /* it */ "Seleziona una parola a destra", - /* ja */ "単語単位で右を選択", - /* ko */ "단어 단위로 오른쪽 선택", - /* pt_br */ "Selecionar uma palavra à direita", - /* ru */ "Выделить слово вправо", - /* zh_hans */ "按词选择右侧", - /* zh_hant */ "按詞選取右側", - ], - // ShortcutSelectLineStart - [ - /* en */ "Select to start of line", - /* de */ "Bis zum Zeilenanfang auswählen", - /* es */ "Seleccionar hasta el inicio de la línea", - /* fr */ "Sélectionner jusqu’au début de la ligne", - /* it */ "Seleziona fino all’inizio della riga", - /* ja */ "行頭まで選択", - /* ko */ "줄 시작까지 선택", - /* pt_br */ "Selecionar até o início da linha", - /* ru */ "Выделить до начала строки", - /* zh_hans */ "选择到行首", - /* zh_hant */ "選取到行首", - ], - // ShortcutSelectLineEnd - [ - /* en */ "Select to end of line", - /* de */ "Bis zum Zeilenende auswählen", - /* es */ "Seleccionar hasta el final de la línea", - /* fr */ "Sélectionner jusqu’à la fin de la ligne", - /* it */ "Seleziona fino alla fine della riga", - /* ja */ "行末まで選択", - /* ko */ "줄 끝까지 선택", - /* pt_br */ "Selecionar até o final da linha", - /* ru */ "Выделить до конца строки", - /* zh_hans */ "选择到行尾", - /* zh_hant */ "選取到行尾", - ], - // ShortcutSelectDocStart - [ - /* en */ "Select to start of document", - /* de */ "Bis zum Dokumentanfang auswählen", - /* es */ "Seleccionar hasta el inicio del documento", - /* fr */ "Sélectionner jusqu’au début du document", - /* it */ "Seleziona fino all’inizio del documento", - /* ja */ "ドキュメントの先頭まで選択", - /* ko */ "문서 처음까지 선택", - /* pt_br */ "Selecionar até o início do documento", - /* ru */ "Выделить до начала документа", - /* zh_hans */ "选择到文档开头", - /* zh_hant */ "選取到文件開頭", - ], - // ShortcutSelectDocEnd - [ - /* en */ "Select to end of document", - /* de */ "Bis zum Dokumentende auswählen", - /* es */ "Seleccionar hasta el final del documento", - /* fr */ "Sélectionner jusqu’à la fin du document", - /* it */ "Seleziona fino alla fine del documento", - /* ja */ "ドキュメントの末尾まで選択", - /* ko */ "문서 끝까지 선택", - /* pt_br */ "Selecionar até o final do documento", - /* ru */ "Выделить до конца документа", - /* zh_hans */ "选择到文档结尾", - /* zh_hant */ "選取到文件結尾", ], // ShortcutSelectLine [ @@ -1148,104 +990,6 @@ const S_LANG_LUT: [[&str; LangId::Count as usize]; LocId::Count as usize] = [ /* zh_hans */ "选择行", /* zh_hant */ "選取行", ], - // ShortcutDeletePrevWord - [ - /* en */ "Delete previous word", - /* de */ "Vorheriges Wort löschen", - /* es */ "Eliminar palabra anterior", - /* fr */ "Supprimer le mot précédent", - /* it */ "Elimina la parola precedente", - /* ja */ "前の単語を削除", - /* ko */ "이전 단어 삭제", - /* pt_br */ "Excluir palavra anterior", - /* ru */ "Удалить предыдущее слово", - /* zh_hans */ "删除前一个词", - /* zh_hant */ "刪除前一詞", - ], - // ShortcutDeleteNextWord - [ - /* en */ "Delete next word", - /* de */ "Nächstes Wort löschen", - /* es */ "Eliminar palabra siguiente", - /* fr */ "Supprimer le мот suivant", - /* it */ "Elimina la parola successiva", - /* ja */ "次の単語を削除", - /* ko */ "다음 단어 삭제", - /* pt_br */ "Excluir próxima palavra", - /* ru */ "Удалить следующее слово", - /* zh_hans */ "删除下一个词", - /* zh_hant */ "刪除下一詞", - ], - // ShortcutPasteShiftInsert - [ - /* en */ "Paste", - /* de */ "Einfügen", - /* es */ "Pegar", - /* fr */ "Coller", - /* it */ "Incolla", - /* ja */ "貼り付け", - /* ko */ "붙여넣기", - /* pt_br */ "Colar", - /* ru */ "Вставить", - /* zh_hans */ "粘贴", - /* zh_hant */ "貼上", - ], - // ShortcutCopyCtrlInsert - [ - /* en */ "Copy", - /* de */ "Kopieren", - /* es */ "Copiar", - /* fr */ "Copier", - /* it */ "Copia", - /* ja */ "コピー", - /* ko */ "복사", - /* pt_br */ "Copiar", - /* ru */ "Копировать", - /* zh_hans */ "复制", - /* zh_hant */ "複製", - ], - // ShortcutCutShiftDelete - [ - /* en */ "Cut", - /* de */ "Ausschneiden", - /* es */ "Cortar", - /* fr */ "Couper", - /* it */ "Taglia", - /* ja */ "切り取り", - /* ko */ "잘라내기", - /* pt_br */ "Cortar", - /* ru */ "Вырезать", - /* zh_hans */ "剪切", - /* zh_hant */ "剪下", - ], - // ShortcutMoveCursorLeftWordMac - [ - /* en */ "Move cursor left by word (macOS)", - /* de */ "Cursor wortweise nach links (macOS)", - /* es */ "Mover cursor una palabra a la izquierda (macOS)", - /* fr */ "Déplacer le curseur d’un mot à gauche (macOS)", - /* it */ "Sposta cursore di una parola a sinistra (macOS)", - /* ja */ "単語単位で左へ移動 (macOS)", - /* ko */ "단어 단위로 왼쪽 이동 (macOS)", - /* pt_br */ "Mover cursor uma palavra à esquerda (macOS)", - /* ru */ "Переместить курсор на слово влево (macOS)", - /* zh_hans */ "光标左移一词 (macOS)", - /* zh_hant */ "游標左移一詞 (macOS)", - ], - // ShortcutMoveCursorRightWordMac - [ - /* en */ "Move cursor right by word (macOS)", - /* de */ "Cursor wortweise nach rechts (macOS)", - /* es */ "Mover cursor una palabra a la derecha (macOS)", - /* fr */ "Déplacer le curseur d’un mot à droite (macOS)", - /* it */ "Sposta cursore di una parola a destra (macOS)", - /* ja */ "単語単位で右へ移動 (macOS)", - /* ko */ "단어 단위로 오른쪽 이동 (macOS)", - /* pt_br */ "Mover cursor uma palavra à direita (macOS)", - /* ru */ "Переместить курсор на слово вправо (macOS)", - /* zh_hans */ "光标右移一词 (macOS)", - /* zh_hant */ "游標右移一詞 (macOS)", - ], ]; static mut S_LANG: LangId = LangId::en; From c216171876e0c50106401d826582434510b35121 Mon Sep 17 00:00:00 2001 From: four-poetic-drew Date: Sat, 5 Jul 2025 17:34:28 +0800 Subject: [PATCH 5/9] Revert localisation edits --- src/bin/edit/localization.rs | 44 ++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/src/bin/edit/localization.rs b/src/bin/edit/localization.rs index 62bacb9fab15..63c79416f629 100644 --- a/src/bin/edit/localization.rs +++ b/src/bin/edit/localization.rs @@ -264,17 +264,17 @@ const S_LANG_LUT: [[&str; LangId::Count as usize]; LocId::Count as usize] = [ ], // FileOpen [ - /* en */ "Open File", - /* de */ "Datei öffnen", - /* es */ "Abrir archivo", - /* fr */ "Ouvrir un fichier", - /* it */ "Apri file", - /* ja */ "ファイルを開く", - /* ko */ "파일 열기", - /* pt_br */ "Abrir arquivo", - /* ru */ "Открыть файл", - /* zh_hans */ "打开文件", - /* zh_hant */ "開啟檔案", + /* en */ "Open File...", + /* de */ "Datei öffnen...", + /* es */ "Abrir archivo...", + /* fr */ "Ouvrir un fichier...", + /* it */ "Apri file...", + /* ja */ "ファイルを開く...", + /* ko */ "파일 열기...", + /* pt_br */ "Abrir arquivo...", + /* ru */ "Открыть файл...", + /* zh_hans */ "打开文件...", + /* zh_hant */ "開啟檔案...", ], // FileSave [ @@ -334,17 +334,17 @@ const S_LANG_LUT: [[&str; LangId::Count as usize]; LocId::Count as usize] = [ ], // FileGoto [ - /* en */ "Go to Line:Column", - /* de */ "Gehe zu Zeile:Spalte", - /* es */ "Ir a línea:columna", - /* fr */ "Aller à la ligne:colonne", - /* it */ "Vai a riga:colonna", - /* ja */ "行:列へ移動", + /* en */ "Go to Line:Column...", + /* de */ "Gehe zu Zeile:Spalte...", + /* es */ "Ir a línea:columna...", + /* fr */ "Aller à la ligne:colonne...", + /* it */ "Vai a riga:colonna...", + /* ja */ "行:列へ移動...", /* ko */ "행:열로 이동", - /* pt_br */ "Ir para linha:coluna", - /* ru */ "Перейти к строке:столбцу", - /* zh_hans */ "转到行:列", - /* zh_hant */ "跳至行:列", + /* pt_br */ "Ir para linha:coluna...", + /* ru */ "Перейти к строке:столбцу...", + /* zh_hans */ "转到行:列...", + /* zh_hant */ "跳至行:列...", ], // Edit (a menu bar item) @@ -953,7 +953,7 @@ const S_LANG_LUT: [[&str; LangId::Count as usize]; LocId::Count as usize] = [ /* en */ "File already exists. Do you want to overwrite it?", /* de */ "Datei existiert bereits. Möchten Sie sie überschreiben?", /* es */ "El archivo ya existe. ¿Desea sobrescribirlo?", - /* fr */ "Le fichier существует déjà. Voulez-vous l’écraser ?", + /* fr */ "Le fichier existe déjà. Voulez-vous l’écraser ?", /* it */ "Il file esiste già. Vuoi sovrascriverlo?", /* ja */ "ファイルは既に存在します。上書きしますか?", /* ko */ "파일이 이미 존재합니다. 덮어쓰시겠습니까?", From 4f53126709efcbfb9c8f78234899262f693087dd Mon Sep 17 00:00:00 2001 From: four-poetic-drew Date: Sun, 6 Jul 2025 11:07:39 +0800 Subject: [PATCH 6/9] Fixed localisation changes --- src/bin/edit/draw_menubar.rs | 2 +- src/bin/edit/localization.rs | 42 ++++++++++++++++++------------------ src/bin/edit/main.rs | 2 +- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/bin/edit/draw_menubar.rs b/src/bin/edit/draw_menubar.rs index b090dcf96e11..0548235ca1fa 100644 --- a/src/bin/edit/draw_menubar.rs +++ b/src/bin/edit/draw_menubar.rs @@ -179,7 +179,7 @@ pub fn draw_dialog_about(ctx: &mut Context, state: &mut State) { } } -pub fn draw_keyboard_shortcuts_list(ctx: &mut Context, state: &mut State) { +pub fn draw_dialog_shortcuts(ctx: &mut Context, state: &mut State) { ctx.modal_begin("Shortcuts", loc(LocId::KeyboardShortcutDialogTitle)); { ctx.block_begin("content"); diff --git a/src/bin/edit/localization.rs b/src/bin/edit/localization.rs index 63c79416f629..485c7737abd3 100644 --- a/src/bin/edit/localization.rs +++ b/src/bin/edit/localization.rs @@ -264,17 +264,17 @@ const S_LANG_LUT: [[&str; LangId::Count as usize]; LocId::Count as usize] = [ ], // FileOpen [ - /* en */ "Open File...", - /* de */ "Datei öffnen...", - /* es */ "Abrir archivo...", - /* fr */ "Ouvrir un fichier...", - /* it */ "Apri file...", - /* ja */ "ファイルを開く...", - /* ko */ "파일 열기...", - /* pt_br */ "Abrir arquivo...", - /* ru */ "Открыть файл...", - /* zh_hans */ "打开文件...", - /* zh_hant */ "開啟檔案...", + /* en */ "Open File…", + /* de */ "Datei öffnen…", + /* es */ "Abrir archivo…", + /* fr */ "Ouvrir un fichier…", + /* it */ "Apri file…", + /* ja */ "ファイルを開く…", + /* ko */ "파일 열기…", + /* pt_br */ "Abrir arquivo…", + /* ru */ "Открыть файл…", + /* zh_hans */ "打开文件…", + /* zh_hant */ "開啟檔案…", ], // FileSave [ @@ -334,17 +334,17 @@ const S_LANG_LUT: [[&str; LangId::Count as usize]; LocId::Count as usize] = [ ], // FileGoto [ - /* en */ "Go to Line:Column...", - /* de */ "Gehe zu Zeile:Spalte...", - /* es */ "Ir a línea:columna...", - /* fr */ "Aller à la ligne:colonne...", - /* it */ "Vai a riga:colonna...", - /* ja */ "行:列へ移動...", + /* en */ "Go to Line:Column…", + /* de */ "Gehe zu Zeile:Spalte…", + /* es */ "Ir a línea:columna…", + /* fr */ "Aller à la ligne:colonne…", + /* it */ "Vai a riga:colonna…", + /* ja */ "行:列へ移動…", /* ko */ "행:열로 이동", - /* pt_br */ "Ir para linha:coluna...", - /* ru */ "Перейти к строке:столбцу...", - /* zh_hans */ "转到行:列...", - /* zh_hant */ "跳至行:列...", + /* pt_br */ "Ir para linha:coluna…", + /* ru */ "Перейти к строке:столбцу…", + /* zh_hans */ "转到行:列…", + /* zh_hant */ "跳至行:列…", ], // Edit (a menu bar item) diff --git a/src/bin/edit/main.rs b/src/bin/edit/main.rs index 262afa0a55b4..7994da67e00a 100644 --- a/src/bin/edit/main.rs +++ b/src/bin/edit/main.rs @@ -318,7 +318,7 @@ fn draw(ctx: &mut Context, state: &mut State) { draw_error_log(ctx, state); } if state.wants_shortcuts_list { - draw_keyboard_shortcuts_list(ctx, state); + draw_dialog_shortcuts(ctx, state); } if let Some(key) = ctx.keyboard_input() { From 263f83395f1a4bdc55be1a724860281d887645d5 Mon Sep 17 00:00:00 2001 From: four-poetic-drew Date: Sun, 6 Jul 2025 11:08:30 +0800 Subject: [PATCH 7/9] Fixed localisation changes --- src/bin/edit/localization.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bin/edit/localization.rs b/src/bin/edit/localization.rs index 485c7737abd3..59b5a8d0f414 100644 --- a/src/bin/edit/localization.rs +++ b/src/bin/edit/localization.rs @@ -340,7 +340,7 @@ const S_LANG_LUT: [[&str; LangId::Count as usize]; LocId::Count as usize] = [ /* fr */ "Aller à la ligne:colonne…", /* it */ "Vai a riga:colonna…", /* ja */ "行:列へ移動…", - /* ko */ "행:열로 이동", + /* ko */ "행:열로 이동…", /* pt_br */ "Ir para linha:coluna…", /* ru */ "Перейти к строке:столбцу…", /* zh_hans */ "转到行:列…", From 38a7fa13adf83c3a6726a5d1dbed24a0e8db343d Mon Sep 17 00:00:00 2001 From: four-poetic-drew Date: Sun, 6 Jul 2025 15:47:12 +0800 Subject: [PATCH 8/9] Add F1=Help to bottom left of status bar for keyboard shortcut hint --- src/bin/edit/draw_statusbar.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/bin/edit/draw_statusbar.rs b/src/bin/edit/draw_statusbar.rs index f7a631ace129..d81bc1756b1d 100644 --- a/src/bin/edit/draw_statusbar.rs +++ b/src/bin/edit/draw_statusbar.rs @@ -25,6 +25,7 @@ pub fn draw_statusbar(ctx: &mut Context, state: &mut State) { let mut tb = doc.buffer.borrow_mut(); ctx.table_next_row(); + ctx.label("help-hint", "[F1=Help]"); if ctx.button("newline", if tb.is_crlf() { "CRLF" } else { "LF" }, ButtonStyle::default()) { let is_crlf = tb.is_crlf(); @@ -121,7 +122,7 @@ pub fn draw_statusbar(ctx: &mut Context, state: &mut State) { } } ctx.list_end(); - + ctx.list_begin("width"); ctx.attr_padding(Rect::two(0, 2)); { @@ -171,7 +172,7 @@ pub fn draw_statusbar(ctx: &mut Context, state: &mut State) { if tb.is_dirty() { ctx.label("dirty", "*"); } - + ctx.block_begin("filename-container"); ctx.attr_intrinsic_size(Size { width: COORD_TYPE_SAFE_MAX, height: 1 }); { From ff7695d339bbe14b0410410edf144e1ba2421c5f Mon Sep 17 00:00:00 2001 From: four-poetic-drew Date: Sun, 6 Jul 2025 15:56:25 +0800 Subject: [PATCH 9/9] Minor formatting changes --- src/bin/edit/draw_menubar.rs | 5 +++-- src/bin/edit/main.rs | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/bin/edit/draw_menubar.rs b/src/bin/edit/draw_menubar.rs index 0548235ca1fa..ddd5431ce1d8 100644 --- a/src/bin/edit/draw_menubar.rs +++ b/src/bin/edit/draw_menubar.rs @@ -188,7 +188,7 @@ pub fn draw_dialog_shortcuts(ctx: &mut Context, state: &mut State) { { ctx.attr_position(Position::Center); - let shortcuts: [(&'static str, &'static str); 15] = [ + let shortcuts = [ (loc(LocId::EditCopy), "Ctrl + C"), (loc(LocId::EditCut), "Ctrl + X"), (loc(LocId::EditPaste), "Ctrl + V"), @@ -203,7 +203,8 @@ pub fn draw_dialog_shortcuts(ctx: &mut Context, state: &mut State) { (loc(LocId::FileClose), "Ctrl + W"), (loc(LocId::FileExit), "Ctrl + Q"), (loc(LocId::FileGoto), "Ctrl + G"), - (loc(LocId::ShortcutSelectLine), "Ctrl + L"), ]; + (loc(LocId::ShortcutSelectLine), "Ctrl + L"), + ]; ctx.table_begin("shortcuts_table"); ctx.table_set_cell_gap(Size { width: (5), height: (0) }); diff --git a/src/bin/edit/main.rs b/src/bin/edit/main.rs index 7994da67e00a..eb1ad69735c9 100644 --- a/src/bin/edit/main.rs +++ b/src/bin/edit/main.rs @@ -351,7 +351,7 @@ fn draw(ctx: &mut Context, state: &mut State) { } else if key == vk::F3 { search_execute(ctx, state, SearchAction::Search); } else if key == vk:: F1 { - state.wants_shortcuts_list=true; + state.wants_shortcuts_list = true; } else { return;