Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/bin/edit/draw_menubar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ fn draw_menu_view(ctx: &mut Context, state: &mut State) {
if ctx.menubar_menu_button(loc(LocId::ViewFocusStatusbar), 'S', vk::NULL) {
state.wants_statusbar_focus = true;
}
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;
Expand Down
10 changes: 5 additions & 5 deletions src/bin/edit/draw_statusbar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -305,8 +305,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);
Expand Down Expand Up @@ -334,7 +334,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();
}

Expand All @@ -343,6 +343,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;
}
}
50 changes: 25 additions & 25 deletions src/bin/edit/localization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pub enum LocId {
View,
ViewFocusStatusbar,
ViewWordWrap,
ViewDocumentPicker,
ViewGoToFile,

// Help menu
Help,
Expand Down Expand Up @@ -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
[
Expand Down Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions src/bin/edit/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,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);
Expand All @@ -338,7 +338,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 {
Expand Down
4 changes: 2 additions & 2 deletions src/bin/edit/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ pub struct State {
pub wants_save: bool,
pub wants_statusbar_focus: bool,
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,
Expand Down Expand Up @@ -202,7 +202,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,
Expand Down