mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
fix stable scrollbars
This commit is contained in:
@@ -3,22 +3,21 @@ Screen {
|
||||
}
|
||||
|
||||
#tree-view {
|
||||
display: none;
|
||||
display: none;
|
||||
scrollbar-gutter: stable;
|
||||
width: auto;
|
||||
overflow: auto;
|
||||
overflow-y: scroll;
|
||||
width: auto;
|
||||
height: 100%;
|
||||
dock: left;
|
||||
|
||||
}
|
||||
|
||||
CodeBrowser.-show-tree #tree-view {
|
||||
display: block;
|
||||
dock: left;
|
||||
height: 100%;
|
||||
display: block;
|
||||
max-width: 50%;
|
||||
background: #151C25;
|
||||
}
|
||||
|
||||
DirectoryTree {
|
||||
padding-right: 1;
|
||||
}
|
||||
|
||||
#code-view {
|
||||
overflow: auto scroll;
|
||||
|
||||
@@ -39,7 +39,7 @@ class CodeBrowser(App):
|
||||
path = "./" if len(sys.argv) < 2 else sys.argv[1]
|
||||
yield Header()
|
||||
yield Container(
|
||||
Vertical(DirectoryTree(path), id="tree-view"),
|
||||
DirectoryTree(path, id="tree-view"),
|
||||
Vertical(Static(id="code", expand=True), id="code-view"),
|
||||
)
|
||||
yield Footer()
|
||||
@@ -47,8 +47,11 @@ class CodeBrowser(App):
|
||||
def on_mount(self, event: events.Mount) -> None:
|
||||
self.query_one(DirectoryTree).focus()
|
||||
|
||||
def on_directory_tree_file_click(self, event: DirectoryTree.FileClick) -> None:
|
||||
def on_directory_tree_file_selected(
|
||||
self, event: DirectoryTree.FileSelected
|
||||
) -> None:
|
||||
"""Called when the user click a file in the directory tree."""
|
||||
event.stop()
|
||||
code_view = self.query_one("#code", Static)
|
||||
try:
|
||||
syntax = Syntax.from_path(
|
||||
|
||||
Reference in New Issue
Block a user