Skip to content

Commit cf5f6a2

Browse files
committed
✨ Python 3.12
1 parent ba572c5 commit cf5f6a2

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

browsr/screens/code_browser.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,16 @@ def action_parent_dir(self) -> None:
116116
directory_tree_open = self.code_browser.has_class("-show-tree")
117117
if not directory_tree_open:
118118
return
119-
new_path = self.config_object.path.parent.resolve()
120-
if new_path != self.config_object.path:
121-
self.config_object.file_path = str(new_path)
122-
self.code_browser.directory_tree.path = new_path
119+
if (
120+
self.code_browser.directory_tree.path
121+
!= self.code_browser.directory_tree.path.parent
122+
):
123+
self.code_browser.directory_tree.path = (
124+
self.code_browser.directory_tree.path.parent
125+
)
123126
self.notify(
124127
title="Directory Changed",
125-
message=str(new_path),
128+
message=str(self.code_browser.directory_tree.path),
126129
severity="information",
127130
timeout=1,
128131
)
@@ -152,9 +155,9 @@ def action_reload(self) -> None:
152155
message_lines = []
153156
if reload_directory:
154157
self.code_browser.directory_tree.reload()
158+
directory_name = self.code_browser.directory_tree.path.name or "/"
155159
message_lines.append(
156-
"[bold]Directory:[/bold] "
157-
f"[italic]{self.config_object.path.name}[/italic]"
160+
"[bold]Directory:[/bold] " f"[italic]{directory_name}[/italic]"
158161
)
159162
if reload_file:
160163
selected_file_path = cast(UPath, self.code_browser.selected_file_path)

browsr/widgets/code_browser.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,6 @@ def handle_directory_double_click(
200200
Called when the user double clicks a directory in the directory tree.
201201
"""
202202
self.directory_tree.path = message.path
203-
self.config_object.file_path = str(message.path)
204203
self.notify(
205204
title="Directory Changed",
206205
message=str(message.path),

tests/debug_app.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@ async def test_debug_app() -> None:
1313
"""
1414
Test the actual browsr app
1515
"""
16-
config = TextualAppContext(
17-
file_path="github://juftin:textual-universal-directorytree@main", debug=True
18-
)
16+
config = TextualAppContext(file_path=".", debug=True)
1917
app = Browsr(config_object=config)
2018
async with app.run_test() as pilot:
2119
_ = pilot.app

0 commit comments

Comments
 (0)