Skip to content

Commit 11c3790

Browse files
committed
binding tweak
1 parent b48178b commit 11c3790

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/textual/app.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -279,11 +279,7 @@ class App(Generic[ReturnType], DOMNode):
279279
also the `sub_title` attribute.
280280
"""
281281

282-
BINDINGS = [
283-
Binding("ctrl+c", "quit", "Quit", show=False, priority=True),
284-
Binding("tab", "focus_next", "Focus Next", show=False),
285-
Binding("shift+tab", "focus_previous", "Focus Previous", show=False),
286-
]
282+
BINDINGS = [Binding("ctrl+c", "quit", "Quit", show=False, priority=True)]
287283

288284
title: Reactive[str] = Reactive("", compute=False)
289285
sub_title: Reactive[str] = Reactive("", compute=False)
@@ -1984,7 +1980,7 @@ def _binding_chain(self) -> list[tuple[DOMNode, Bindings]]:
19841980
def _modal_binding_chain(self) -> list[tuple[DOMNode, Bindings]]:
19851981
"""The binding chain, ignoring everything before the last modal."""
19861982
binding_chain = self._binding_chain
1987-
for index, (node, _bindings) in enumerate(binding_chain):
1983+
for index, (node, _bindings) in enumerate(binding_chain, 1):
19881984
if node.is_modal:
19891985
return binding_chain[:index]
19901986
return binding_chain

src/textual/screen.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from ._compositor import Compositor, MapGeometry
1212
from ._context import visible_screen_stack
1313
from ._types import CallbackType
14+
from .binding import Binding
1415
from .css.match import match
1516
from .css.parse import parse_selectors
1617
from .css.query import QueryType
@@ -45,6 +46,11 @@ class Screen(Widget):
4546
stack_updates: Reactive[int] = Reactive(0, repaint=False)
4647
"""An integer that updates when the screen is resumed."""
4748

49+
BINDINGS = [
50+
Binding("tab", "focus_next", "Focus Next", show=False),
51+
Binding("shift+tab", "focus_previous", "Focus Previous", show=False),
52+
]
53+
4854
def __init__(
4955
self,
5056
name: str | None = None,

0 commit comments

Comments
 (0)