Skip to content

Commit

Permalink
🔀 Merge pull request #19 from davep/cosmetics
Browse files Browse the repository at this point in the history
Small cosmetic tweaks
  • Loading branch information
davep authored Feb 16, 2025
2 parents a50f1c9 + 9d1aea3 commit e43eb52
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/hike/widgets/navigation/widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class Navigation(Vertical):
DEFAULT_CSS = """
Navigation {
width: 27%;
min-width: 38;
dock: left;
background: transparent;
Expand Down
18 changes: 16 additions & 2 deletions src/hike/widgets/viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,29 @@ class ViewerTitle(Label):
color: $foreground;
content-align: right middle;
width: 1fr;
height: 1;
}
"""

location: var[HikeLocation | None] = var(None)
location: var[HikeLocation | None] = var(None, always_update=True)
"""The location to display."""

def _watch_location(self) -> None:
"""React to the location changing."""
self.update(str(self.location or ""))
if (
len(
display := ""
if self.location is None
else str(self.location)[-self.size.width :]
)
>= self.size.width
):
display = f"…{display[1:]}"
self.update(display)

def on_resize(self) -> None:
"""Handle the widget being resized."""
self.location = self.location

@on(Click)
def _maybe_clipboard(self, message: Click) -> None:
Expand Down

0 comments on commit e43eb52

Please sign in to comment.