fix scrollbar refresh

This commit is contained in:
Will McGugan
2022-05-11 09:31:57 +01:00
parent 8f38ea4494
commit 509a49c594
3 changed files with 9 additions and 11 deletions

View File

@@ -605,8 +605,5 @@ class Compositor:
update_region = region.intersection(clip)
if update_region:
add_region(update_region)
print("UPDATE_WIDGET")
print(widgets)
print(regions)
update = self.render(regions or None)
return update

View File

@@ -7,7 +7,7 @@ from pathlib import Path, PurePath
from typing import cast, Iterable
import rich.repr
from rich.console import RenderableType, Console, ConsoleOptions
from rich.console import RenderableType, RenderResult, Console, ConsoleOptions
from rich.highlighter import ReprHighlighter
from rich.markup import render
from rich.padding import Padding
@@ -68,10 +68,10 @@ class StylesheetErrors:
def __rich_console__(
self, console: Console, options: ConsoleOptions
) -> RenderableType:
) -> RenderResult:
error_count = 0
for rule in self.rules:
for is_last, (token, message) in loop_last(rule.errors):
for token, message in rule.errors:
error_count += 1
if token.path:
@@ -297,7 +297,6 @@ class Stylesheet:
for name, specificity_rules in rule_attributes.items()
},
)
self.replace_rules(node, node_rules, animate=animate)
@classmethod
@@ -363,8 +362,9 @@ class Stylesheet:
setattr(base_styles, key, new_value)
else:
# Not animated, so we apply the rules directly
get_rule = rules.get
for key in modified_rule_keys:
setattr(base_styles, key, rules.get(key))
setattr(base_styles, key, get_rule(key))
def update(self, root: DOMNode, animate: bool = False) -> None:
"""Update a node and its children."""

View File

@@ -668,7 +668,6 @@ class Widget(DOMNode):
def watch_mouse_over(self, value: bool) -> None:
"""Update from CSS if mouse over state changes."""
return
self.app.update_styles()
def watch_has_focus(self, value: bool) -> None:
@@ -728,8 +727,10 @@ class Widget(DOMNode):
if self._dirty_regions:
self._render_lines()
if self.is_container:
self.horizontal_scrollbar.refresh()
self.vertical_scrollbar.refresh()
if self.show_horizontal_scrollbar:
self.horizontal_scrollbar.refresh()
if self.show_vertical_scrollbar:
self.vertical_scrollbar.refresh()
lines = self._render_cache.lines[start:end]
return lines