Skip to content

Strip.apply_style misses post_style parameter for Segment.apply_style #6448

@jbdyn

Description

@jbdyn

Hi,

I wanted to redefine the render_line method of a widget to alter the style of strips returned by the superclass method.

However, my Styles are not applied when calling Strip.apply_style.

The problem is that Strip.apply_style does not expose the post_style parameter to be passed to rich's Segment.apply_style. Its docstring in turn says

Returns an iterable of segments where the style is replaced by style + segment.style + post_style

Without the post_style parameter in Strip.apply_style, I have no way to overwrite the style of a Strip if an internal Segment comes with its own style.

Since I am not a collaborator in this project: A fix is available on my fork at https://github.com/jbdyn/textual/tree/apply-post-style with commit 594265f.

If this patch is not suitable: What would be the alternative if I wanted to change a Strip returned by the superclass's render_line method?

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