From 883869d4c2959e4295c88a66299f383d649debc2 Mon Sep 17 00:00:00 2001 From: Leonard Hecker Date: Tue, 10 Jun 2025 14:03:45 +0200 Subject: [PATCH] Rename "Document Picker" to "Go to File" --- src/bin/edit/draw_menubar.rs | 4 +-- src/bin/edit/draw_statusbar.rs | 10 +++---- src/bin/edit/localization.rs | 50 +++++++++++++++++----------------- src/bin/edit/main.rs | 6 ++-- src/bin/edit/state.rs | 4 +-- 5 files changed, 37 insertions(+), 37 deletions(-) diff --git a/src/bin/edit/draw_menubar.rs b/src/bin/edit/draw_menubar.rs index 07b7c713d05..5dbcc8a17c3 100644 --- a/src/bin/edit/draw_menubar.rs +++ b/src/bin/edit/draw_menubar.rs @@ -107,8 +107,8 @@ fn draw_menu_view(ctx: &mut Context, state: &mut State) { let mut tb = doc.buffer.borrow_mut(); let word_wrap = tb.is_word_wrap_enabled(); - if ctx.menubar_menu_button(loc(LocId::ViewDocumentPicker), 'P', kbmod::CTRL | vk::P) { - state.wants_document_picker = true; + if ctx.menubar_menu_button(loc(LocId::ViewGoToFile), 'F', kbmod::CTRL | vk::P) { + state.wants_go_to_file = true; } if ctx.menubar_menu_button(loc(LocId::FileGoto), 'G', kbmod::CTRL | vk::G) { state.wants_goto = true; diff --git a/src/bin/edit/draw_statusbar.rs b/src/bin/edit/draw_statusbar.rs index 4dc08a74d75..1c47f84c9e3 100644 --- a/src/bin/edit/draw_statusbar.rs +++ b/src/bin/edit/draw_statusbar.rs @@ -184,7 +184,7 @@ pub fn draw_statusbar(ctx: &mut Context, state: &mut State) { filename = &filename_buf; } - state.wants_document_picker |= ctx.button("filename", filename, ButtonStyle::default()); + state.wants_go_to_file |= ctx.button("filename", filename, ButtonStyle::default()); ctx.inherit_focus(); ctx.attr_overflow(Overflow::TruncateMiddle); ctx.attr_position(Position::Right); @@ -301,8 +301,8 @@ fn encoding_picker_update_list(state: &mut State) { state.encoding_picker_results = Some(Vec::from_iter(matches.iter().map(|(_, enc)| *enc))); } -pub fn draw_document_picker(ctx: &mut Context, state: &mut State) { - ctx.modal_begin("document-picker", ""); +pub fn draw_go_to_file(ctx: &mut Context, state: &mut State) { + ctx.modal_begin("go-to-file", loc(LocId::ViewGoToFile)); { let width = (ctx.size().width - 20).max(10); let height = (ctx.size().height - 10).max(10); @@ -330,7 +330,7 @@ pub fn draw_document_picker(ctx: &mut Context, state: &mut State) { ctx.styled_list_item_end(false) == ListSelection::Activated }) { - state.wants_document_picker = false; + state.wants_go_to_file = false; ctx.needs_rerender(); } @@ -339,6 +339,6 @@ pub fn draw_document_picker(ctx: &mut Context, state: &mut State) { ctx.scrollarea_end(); } if ctx.modal_end() { - state.wants_document_picker = false; + state.wants_go_to_file = false; } } diff --git a/src/bin/edit/localization.rs b/src/bin/edit/localization.rs index 0443781363b..f42838625b6 100644 --- a/src/bin/edit/localization.rs +++ b/src/bin/edit/localization.rs @@ -42,7 +42,7 @@ pub enum LocId { View, ViewFocusStatusbar, ViewWordWrap, - ViewDocumentPicker, + ViewGoToFile, // Help menu Help, @@ -303,17 +303,17 @@ const S_LANG_LUT: [[&str; LangId::Count as usize]; LocId::Count as usize] = [ ], // FileClose [ - /* en */ "Close Editor", - /* de */ "Editor schließen", - /* es */ "Cerrar editor", - /* fr */ "Fermer l’éditeur", - /* it */ "Chiudi editor", - /* ja */ "エディターを閉じる", - /* ko */ "편집기 닫기", - /* pt_br */ "Fechar editor", - /* ru */ "Закрыть редактор", - /* zh_hans */ "关闭编辑器", - /* zh_hant */ "關閉編輯器", + /* en */ "Close File", + /* de */ "Datei schließen", + /* es */ "Cerrar archivo", + /* fr */ "Fermer le fichier", + /* it */ "Chiudi file", + /* ja */ "ファイルを閉じる", + /* ko */ "파일 닫기", + /* pt_br */ "Fechar arquivo", + /* ru */ "Закрыть файл", + /* zh_hans */ "关闭文件", + /* zh_hant */ "關閉檔案", ], // FileExit [ @@ -513,19 +513,19 @@ const S_LANG_LUT: [[&str; LangId::Count as usize]; LocId::Count as usize] = [ /* zh_hans */ "自动换行", /* zh_hant */ "自動換行", ], - // ViewDocumentPicker - [ - /* en */ "Document Picker…", - /* de */ "Dokumentauswahl…", - /* es */ "Selector de documentos…", - /* fr */ "Sélecteur de documents…", - /* it */ "Selettore di documenti…", - /* ja */ "ドキュメントピッカー…", - /* ko */ "문서 선택기…", - /* pt_br */ "Seletor de documentos…", - /* ru */ "Выбор документа…", - /* zh_hans */ "文档选择器…", - /* zh_hant */ "文件選擇器…", + // ViewGoToFile + [ + /* en */ "Go to File…", + /* de */ "Gehe zu Datei…", + /* es */ "Ir a archivo…", + /* fr */ "Aller au fichier…", + /* it */ "Vai al file…", + /* ja */ "ファイルへ移動…", + /* ko */ "파일로 이동…", + /* pt_br */ "Ir para arquivo…", + /* ru */ "Перейти к файлу…", + /* zh_hans */ "转到文件…", + /* zh_hant */ "跳至檔案…", ], // Help (a menu bar item) diff --git a/src/bin/edit/main.rs b/src/bin/edit/main.rs index 8d683f05116..79be3f01cb9 100644 --- a/src/bin/edit/main.rs +++ b/src/bin/edit/main.rs @@ -312,8 +312,8 @@ fn draw(ctx: &mut Context, state: &mut State) { if state.wants_encoding_change != StateEncodingChange::None { draw_dialog_encoding_change(ctx, state); } - if state.wants_document_picker { - draw_document_picker(ctx, state); + if state.wants_go_to_file { + draw_go_to_file(ctx, state); } if state.wants_about { draw_dialog_about(ctx, state); @@ -339,7 +339,7 @@ fn draw(ctx: &mut Context, state: &mut State) { } else if key == kbmod::CTRL | vk::W { state.wants_close = true; } else if key == kbmod::CTRL | vk::P { - state.wants_document_picker = true; + state.wants_go_to_file = true; } else if key == kbmod::CTRL | vk::Q { state.wants_exit = true; } else if key == kbmod::CTRL | vk::G { diff --git a/src/bin/edit/state.rs b/src/bin/edit/state.rs index ab02a2b6e24..e5a2e3c41ef 100644 --- a/src/bin/edit/state.rs +++ b/src/bin/edit/state.rs @@ -152,7 +152,7 @@ pub struct State { pub wants_statusbar_focus: bool, pub wants_encoding_change: StateEncodingChange, pub wants_indentation_picker: bool, - pub wants_document_picker: bool, + pub wants_go_to_file: bool, pub wants_about: bool, pub wants_close: bool, pub wants_exit: bool, @@ -200,7 +200,7 @@ impl State { wants_statusbar_focus: false, wants_encoding_change: StateEncodingChange::None, wants_indentation_picker: false, - wants_document_picker: false, + wants_go_to_file: false, wants_about: false, wants_close: false, wants_exit: false,