Skip to content

Link styling disappears while text is drag-selected on the same line #6672

Description

@le-codeur-rapide

A link renders as plain (unstyled) text for as long as a text selection is active on the same line, even though it stays clickable.

Minimal reproduction code

from textual.app import App, ComposeResult
from textual.widgets import Static


class ReproApp(App[None]):
    CSS = "Static { margin: 1 2; link-color: cyan; link-style: underline; }"

    def compose(self) -> ComposeResult:
        yield Static("See the [@click='app.bell()']docs[/] here, then drag-select this line.")


if __name__ == "__main__":
    ReproApp().run()

Run it and drag-select across the line: the cyan underlined docs link turns plain.

Visual.to_strips only applies _apply_link_style when not widget.screen._selecting, so any widget re-rendered during a selection loses its link styling. The @click meta survives (the link stays clickable), only the visible color/underline is dropped .

Textual 8.2.8, Python 3.12.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions