From ff3137419aaf3ea9454a370d2c8289845de58d41 Mon Sep 17 00:00:00 2001 From: SpookyDervish <78246495+SpookyDervish@users.noreply.github.com> Date: Fri, 31 Oct 2025 06:54:22 +1100 Subject: [PATCH] fixed a bug with long filenames hiding options in the context menu --- directory_tree_custom.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/directory_tree_custom.py b/directory_tree_custom.py index 2fc7052..ce46b40 100644 --- a/directory_tree_custom.py +++ b/directory_tree_custom.py @@ -16,10 +16,7 @@ class CustomDirectoryTree(DirectoryTree): def context_menu_chosen(self, result): - if result == "Open": - self.select_node(self.right_clicked_node) - self.right_clicked_node = None - elif result == "Delete": + if result == "Delete": def delete_confirm(will_delete: bool | None): if will_delete == True: shutil.rmtree(self.right_clicked_node.data.path) @@ -50,12 +47,14 @@ class CustomDirectoryTree(DirectoryTree): options = None if self._safe_is_dir(self.right_clicked_node.data.path): - options = ["New Folder", "New File", NoSelectStatic(f'[d]{"-" * 17}[/]'), "Delete", "Rename", "Open"] + options = ["New Folder", "New File", NoSelectStatic(f'[d]{"-" * 17}[/]'), "Delete", "Rename"] else: - options = ["Delete", "Rename", "Open"] + options = ["Delete", "Rename"] + + file_name = str(self.right_clicked_node.label) if len(self.right_clicked_node.label) <= 17 else self.right_clicked_node.label[:14] + "..." self.app.push_screen(ContextMenu( - [NoSelectStatic(f"[b]{self.right_clicked_node.label}[/]"), NoSelectStatic(f'[d]{"-" * 17}[/]')] + options, + [NoSelectStatic(f"[b]{file_name}[/]"), NoSelectStatic(f'[d]{"-" * 17}[/]')] + options, event.screen_offset ), self.context_menu_chosen)