commit 96122ce9a1fce816da654d60218cce92efc00123 from: Brett Fisher date: Mon Jul 6 15:45:28 2026 UTC aestel/menu.lua, aestel/navigate.lua: Add toggle for hidden files. - Modify menu.lua to return -1 when the '.' key is pressed. - Implement show_hidden state in navigate.browse loop. - Update build_list to filter hidden files based on state. - Fix logic in M.browse to correctly handle the '.' toggle signal without interrupting the navigation loop. commit - 10c33e752bf60594a66bdb3ae861ad8ed8c7f4a1 commit + 96122ce9a1fce816da654d60218cce92efc00123 blob - eec5bedd611d470163ae99559843d23ff39bc980 blob + ab41080edff33d734e5cc7b84b712ff5515c5da8 --- aestel/menu.lua +++ aestel/menu.lua @@ -122,6 +122,9 @@ function M.menu(title, options, start_row, header_line elseif key == "h" or key == "left" then -- CHANGED: Added "left" for up dir result = 0 -- Signal "go up" running = false + elseif key == "." then -- NEW: Toggle hidden + result = -1 + running = false elseif key == "l" or key == "right" or key == "\r" or key == "\n" then -- CHANGED: Added "right" for down dir/select result = selected_index -- Select current (dir or file) running = false blob - 64eda84279ad104dad24a195f6ffee9ec73ef9cc blob + 1ae918510c51a162be90f8426c383b4913c331ef --- aestel/navigate.lua +++ aestel/navigate.lua @@ -61,10 +61,13 @@ local function change_dir(cur, target, base_dir) return new_path end -local function build_list(path) +local function build_list(path, show_hidden) local dirs, files = {}, {} for item in lfs.dir(path) do if item ~= "." and item ~= ".." then + if not show_hidden and item:sub(1,1) == "." then + -- skip hidden + else local full = join_path(path, item) local attr = lfs.attributes(full) if attr then @@ -74,6 +77,7 @@ local function build_list(path) table.insert(files, item) end end + end end end table.sort(dirs) @@ -92,13 +96,14 @@ end function M.browse(start_dir, base_dir, title) title = title or "" local cwd = normalize_path(start_dir or lfs.currentdir() or home_dir) + local show_hidden = false local header_lines = display.write_header(title) local running = true local selected_file = nil while running do - local items = build_list(cwd) + local items = build_list(cwd, show_hidden) if #items == 0 then local selected_index = menu.menu(title, items, header_lines + 1, header_lines, "Empty directory. Press 'h' to go up, 'q' to quit.") if selected_index == 0 then @@ -118,6 +123,8 @@ function M.browse(start_dir, base_dir, title) if not selected_index then running = false + elseif selected_index == -1 then + show_hidden = not show_hidden elseif selected_index == 0 then local new_cwd, err = change_dir(cwd, "..", base_dir) if new_cwd then