Repository: Textualize/textual
File: src/textual/document/_document_navigator.py (Python)

Code before:
        """
        return location[1] == 0

    def is_start_of_wrapped_line(self, location: Location) -> bool:
        """True when the location is at the start of the first wrapped line.

        Args:
            location: The location to check.

        Returns:
             True if the location is at column index 0.
        """
        if self.is_start_of_document_line(location):
            return True

        row, column = location
        wrap_offsets = self._wrapped_document.get_offsets(row)
        return index(wrap_offsets, column) != -1

    def is_end_of_document_line(self, location: Location) -> bool:
        """True if the location is at the end of a line in the document.

        Note that the "end" of a line is equal to its length (one greater
        than the final index), since there is a space at the end of the line
        for the cursor to rest.

        Args:
            location: The location to examine.

        Returns:
            True if and only if the document is on the last line of the document.
        """
        row, column = location
        row_length = len(self._document[row])
        return column == row_length

    def is_end_of_wrapped_line(self, location: Location) -> bool:
        """True if the location is at the end of a wrapped line.

        Args:
            location: The location to examine.

        Returns:
            True if and only if the cursor is on the last wrapped section of *any* line.
        """
        if self.is_end_of_document_line(location):
            return True

        row, column = location
        wrap_offsets = self._wrapped_document.get_offsets(row)
        return index(wrap_offsets, column - 1) != -1

Review comment (suggestion):
Thanks for taking #4145 on board here! Sorry I realise this PR still a draft, but just a reminder that this docstring might also need correcting here:

```
        Returns:
            True if and only if the document is on the last line of the document.
```

Code after:
        """
        return location[1] == 0

    def is_start_of_wrapped_line(self, location: Location) -> bool:
        """True when the location is at the start of the first wrapped line.

        Args:
            location: The location to check.

        Returns:
             True if the location is at column index 0.
        """
        if self.is_start_of_document_line(location):
            return True

        row, column = location
        wrap_offsets = self._wrapped_document.get_offsets(row)
        return index(wrap_offsets, column) != -1

    def is_end_of_document_line(self, location: Location) -> bool:
        """True if the location is at the end of a line in the document.

        Note that the "end" of a line is equal to its length (one greater
        than the final index), since there is a space at the end of the line
        for the cursor to rest.

        Args:
            location: The location to examine.

        Returns:
            True if and only if the document is at the end of a line in the document.
        """
        row, column = location
        row_length = len(self._document[row])
        return column == row_length

    def is_end_of_wrapped_line(self, location: Location) -> bool:
        """True if the location is at the end of a wrapped line.

        Args:
            location: The location to examine.

        Returns:
            True if and only if the cursor is on the last wrapped section of *any* line.
        """
        if self.is_end_of_document_line(location):
            return True

        row, column = location
        wrap_offsets = self._wrapped_document.get_offsets(row)
        return index(wrap_offsets, column - 1) != -1