File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change 1111
1212from rich .syntax import Syntax
1313from rich .traceback import Traceback
14+
15+ from textual import events
1416from textual .app import App , ComposeResult
1517from textual .containers import Container , Vertical
1618from textual .reactive import var
@@ -30,7 +32,7 @@ class CodeBrowser(App):
3032
3133 def watch_show_tree (self , show_tree : bool ) -> None :
3234 """Called when show_tree is modified."""
33- self .set_class (show_tree , "-show-tree" )
35+ self .set_class (show_tree , "-show-tree" )
3436
3537 def compose (self ) -> ComposeResult :
3638 """Compose our UI."""
@@ -42,6 +44,9 @@ def compose(self) -> ComposeResult:
4244 )
4345 yield Footer ()
4446
47+ def on_mount (self , event : events .Mount ) -> None :
48+ self .query_one (DirectoryTree ).focus ()
49+
4550 def on_directory_tree_file_click (self , event : DirectoryTree .FileClick ) -> None :
4651 """Called when the user click a file in the directory tree."""
4752 code_view = self .query_one ("#code" , Static )
You can’t perform that action at this time.
0 commit comments