mirror of
https://github.com/1j01/textual-paint.git
synced 2025-01-02 20:04:36 +03:00
Make Pyright happy with EnhancedDirectoryTree scrolling
- Don't use a lambda so it doesn't return something - Assert region is found (not None)
This commit is contained in:
parent
91dd804f4a
commit
2a7427c5c8
@ -49,4 +49,8 @@ class EnhancedDirectoryTree(DirectoryTree):
|
||||
# Ugh. OK, I'm going to use some internals, and replicate how scroll_to_node works.
|
||||
# self.scroll_to_region(self._get_label_region(node._line), animate=False, top=True)
|
||||
# Timer is needed to wait for the new nodes to mount, I think.
|
||||
self.set_timer(0.01, lambda: self.scroll_to_region(self._get_label_region(node._line), animate=False, top=True))
|
||||
def scroll_node_to_top():
|
||||
region = self._get_label_region(node._line)
|
||||
assert region, "Node not found in tree"
|
||||
self.scroll_to_region(region, animate=False, top=True)
|
||||
self.set_timer(0.01, scroll_node_to_top)
|
||||
|
Loading…
Reference in New Issue
Block a user