diff --git a/src/textual/widgets/_input.py b/src/textual/widgets/_input.py index c2bfa638a6..ec68be8cd6 100644 --- a/src/textual/widgets/_input.py +++ b/src/textual/widgets/_input.py @@ -148,6 +148,11 @@ def validate_view_position(self, view_position: int) -> int: def watch_cursor_position(self, cursor_position: int) -> None: width = self.content_size.width + if width == 0: + # If the input has no width the view position can't be elsewhere. + self.view_position = 0 + return + view_start = self.view_position view_end = view_start + width cursor_offset = self._cursor_offset