This commit is contained in:
Will McGugan
2022-09-08 11:30:31 +01:00
parent afd22265f4
commit a76f1ea360
2 changed files with 9 additions and 3 deletions

View File

@@ -31,9 +31,15 @@ class CodeBrowser(App):
def on_directory_tree_file_click(self, event: DirectoryTree.FileClick) -> None: def on_directory_tree_file_click(self, event: DirectoryTree.FileClick) -> None:
code_view = self.query_one("#code", Static) code_view = self.query_one("#code", Static)
try: try:
syntax = Syntax.from_path(event.path, line_numbers=True, word_wrap=True) syntax = Syntax.from_path(
event.path,
line_numbers=True,
word_wrap=True,
indent_guides=True,
theme="monokai",
)
except Exception: except Exception:
code_view.update(Traceback()) code_view.update(Traceback(theme="monokai", width=None))
self.sub_title = "ERROR" self.sub_title = "ERROR"
else: else:
code_view.update(syntax) code_view.update(syntax)

View File

@@ -581,7 +581,7 @@ class Widget(DOMNode):
Returns: Returns:
Region: Screen region that contains a widget's content. Region: Screen region that contains a widget's content.
""" """
content_region = self.region.shrink(self.gutter) content_region = self.region.shrink(self.styles.gutter)
return content_region return content_region
@property @property