mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
better jank fix
This commit is contained in:
@@ -331,9 +331,8 @@ class Footer(ScrollableContainer, can_focus=False, can_focus_children=False):
|
||||
self._bindings_ready = True
|
||||
if not screen.app.app_focus:
|
||||
return
|
||||
self.app.delay_update()
|
||||
if self.is_attached and screen is self.screen:
|
||||
await self.recompose()
|
||||
self.call_after_refresh(self.recompose)
|
||||
|
||||
def _on_mouse_scroll_down(self, event: events.MouseScrollDown) -> None:
|
||||
if self.allow_horizontal_scroll:
|
||||
|
||||
@@ -79,7 +79,10 @@ class HelpPanel(Widget):
|
||||
DEFAULT_CLASSES = "-textual-system"
|
||||
|
||||
def on_mount(self):
|
||||
self.watch(self.screen, "focused", self.update_help)
|
||||
def update_help(focused_widget: Widget | None):
|
||||
self.update_help(focused_widget)
|
||||
|
||||
self.watch(self.screen, "focused", update_help)
|
||||
|
||||
def update_help(self, focused_widget: Widget | None) -> None:
|
||||
"""Update the help for the focused widget.
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from collections import defaultdict
|
||||
from functools import partial
|
||||
from itertools import groupby
|
||||
from operator import itemgetter
|
||||
from typing import TYPE_CHECKING
|
||||
@@ -164,16 +163,17 @@ class KeyPanel(VerticalScroll, can_focus=False):
|
||||
yield BindingsTable(shrink=True, expand=False)
|
||||
|
||||
async def on_mount(self) -> None:
|
||||
mount_screen = self.screen
|
||||
|
||||
async def bindings_changed(screen: Screen) -> None:
|
||||
"""Update bindings."""
|
||||
if not screen.app.app_focus:
|
||||
return
|
||||
if self.is_attached and screen is self.screen:
|
||||
self.refresh(recompose=True)
|
||||
if self.is_attached and screen is mount_screen:
|
||||
await self.recompose()
|
||||
|
||||
def _bindings_changed(screen: Screen) -> None:
|
||||
"""Update bindings after a short delay."""
|
||||
screen.set_timer(1 / 20, partial(bindings_changed, screen))
|
||||
self.call_after_refresh(bindings_changed, screen)
|
||||
|
||||
self.set_class(self.app.ansi_color, "-ansi-scrollbar")
|
||||
self.screen.bindings_updated_signal.subscribe(self, _bindings_changed)
|
||||
|
||||
Reference in New Issue
Block a user