diff --git a/src/hike/widgets/navigation/widget.py b/src/hike/widgets/navigation/widget.py index 99d9fa0..e0f184d 100644 --- a/src/hike/widgets/navigation/widget.py +++ b/src/hike/widgets/navigation/widget.py @@ -36,6 +36,7 @@ class Navigation(Vertical): DEFAULT_CSS = """ Navigation { width: 27%; + min-width: 38; dock: left; background: transparent; diff --git a/src/hike/widgets/viewer.py b/src/hike/widgets/viewer.py index e102f33..11888d5 100644 --- a/src/hike/widgets/viewer.py +++ b/src/hike/widgets/viewer.py @@ -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: