Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure the header stays visible for command line on top #23

Merged
merged 2 commits into from
Feb 17, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions src/hike/screens/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# Textual imports.
from textual import on, work
from textual.app import ComposeResult
from textual.containers import Horizontal
from textual.containers import Horizontal, VerticalGroup
from textual.reactive import var
from textual.widgets import Footer, Header, Markdown

Expand Down Expand Up @@ -172,10 +172,11 @@ def __init__(self, arguments: Namespace) -> None:
def compose(self) -> ComposeResult:
"""Compose the content of the screen."""
yield Header()
with Horizontal(id="workspace"):
yield Navigation(classes="panel")
yield Viewer(classes="panel")
yield CommandLine(classes="panel")
with VerticalGroup():
with Horizontal(id="workspace"):
yield Navigation(classes="panel")
yield Viewer(classes="panel")
yield CommandLine(classes="panel")
yield Footer()

def on_mount(self) -> None:
Expand Down Expand Up @@ -334,6 +335,13 @@ def check_action(self, action: str, parameters: tuple[object, ...]) -> bool | No
Returns:
`True` if it can perform, `False` or `None` if not.
"""
if not self.is_mounted:
# Surprisingly it seems that Textual's "dynamic bindings" can
# cause this method to be called before the DOM is up and
# running. This breaks the rule of least astonishment, I'd say,
# but okay let's be defensive... (when I can come up with a nice
# little MRE I'll report it).
return True
if action == Forward.action_name():
return self.query_one(Viewer).history.can_go_forward or None
if action == Backward.action_name():
Expand Down
Loading