Skip to content
Open
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

### Fixed

- Fixed link highlighting when the link spans multiple lines https://github.com/Textualize/textual/pull/6703

## [8.2.8] - 2026-06-30

### Fixed
Expand Down
5 changes: 4 additions & 1 deletion src/textual/style.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ def rich_style_with_offset(self, x: int, y: int) -> RichStyle:
_meta,
) = _get_simple_attributes(self)
color = None if foreground is None else background + foreground
return RichStyle(
rich_style = RichStyle(
color=None if color is None else color.rich_color,
bgcolor=None if background is None else background.rich_color,
bold=bold,
Expand All @@ -506,6 +506,9 @@ def rich_style_with_offset(self, x: int, y: int) -> RichStyle:
link=link,
meta={**self.meta, "offset": (x, y)},
)
if link is not None or _meta is not None:
rich_style._link_id = f"L{id(self)}"
return rich_style

@cached_property
def without_color(self) -> Style:
Expand Down
15 changes: 15 additions & 0 deletions tests/test_style_parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,18 @@ def test_parse_style(markup: str, style: Style) -> None:
print(parsed_style._meta)
print(style._meta)
assert parsed_style == style


@pytest.mark.parametrize(
"style",
[
Style(link="https://textual.textualize.io"),
Style.from_meta({"@click": "app.bell"}),
],
)
def test_rich_style_with_offset_reuses_link_id(style: Style) -> None:

assert (
style.rich_style_with_offset(0, 0)._link_id
== style.rich_style_with_offset(0, 1)._link_id
)
Loading