diff --git a/src/bin/edit/draw_filepicker.rs b/src/bin/edit/draw_filepicker.rs index ffd30f12ebbd..ba92551cadb8 100644 --- a/src/bin/edit/draw_filepicker.rs +++ b/src/bin/edit/draw_filepicker.rs @@ -7,7 +7,7 @@ use std::path::{Path, PathBuf}; use edit::framebuffer::IndexedColor; use edit::helpers::*; -use edit::input::vk; +use edit::input::{kbmod, vk}; use edit::tui::*; use edit::{icu, path}; @@ -40,6 +40,7 @@ pub fn draw_file_picker(ctx: &mut Context, state: &mut State) { ); ctx.attr_intrinsic_size(Size { width, height }); { + let contains_focus = ctx.contains_focus(); let mut activated = false; ctx.table_begin("path"); @@ -98,14 +99,16 @@ pub fn draw_file_picker(ctx: &mut Context, state: &mut State) { ctx.attr_overflow(Overflow::TruncateMiddle); } ctx.list_end(); - - if ctx.contains_focus() && ctx.consume_shortcut(vk::BACK) { - state.file_picker_pending_name = "..".into(); - activated = true; - } } ctx.scrollarea_end(); + if contains_focus + && (ctx.consume_shortcut(vk::BACK) || ctx.consume_shortcut(kbmod::ALT | vk::UP)) + { + state.file_picker_pending_name = "..".into(); + activated = true; + } + if activated { doit = draw_file_picker_update_path(state); diff --git a/src/path.rs b/src/path.rs index 8ce38a774eb1..4ebd59935e52 100644 --- a/src/path.rs +++ b/src/path.rs @@ -9,8 +9,6 @@ use std::path::{Component, MAIN_SEPARATOR_STR, Path, PathBuf}; /// Normalizes a given path by removing redundant components. /// The given path must be absolute (e.g. by joining it with the current working directory). pub fn normalize(path: &Path) -> PathBuf { - debug_assert!(path.is_absolute()); - let mut res = PathBuf::with_capacity(path.as_os_str().as_encoded_bytes().len()); let mut root_len = 0;