textual icon indicating copy to clipboard operation
textual copied to clipboard

Content.from_rich_text(): conceal and overline styles are recognized but not rendered

Open xavierog opened this issue 9 months ago • 2 comments

  • [x] Have you checked closed issues? (https://github.com/Textualize/textual/issues?q=is%3Aissue+is%3Aclosed)

  • [x] Have you checked against the most recent version of Textual? (https://pypi.org/search/?q=textual)

The bug

Content.from_rich_text() recognizes conceal and overline (i.e. no MissingStyle exception), but these styles are not rendered.

Note: I did ensure my terminal was able to render these styles using:

  • echo -e '\x1b[53moverline\x1b[0m\x1b[21mdoubly-underlined'
  • rich --print '[overline]overline[/][underline2]doubly-underlined[/]'

MRE

#!/usr/bin/env python3
from textual.app import App, ComposeResult
from textual.content import Content
from textual.widgets import Label

STYLES = ("bold", "conceal", "italic", "overline", "reverse", "strike", "underline", "underline2")

class ConcealOverline(App):
	def compose(self) -> ComposeResult:
		yield Label("conceal and overline no longer work:")
		rich_markup = " ".join(f"[{style}]{style}[/]" for style in STYLES)
		content = Content.from_rich_text(rich_markup)
		yield Label(content)

if __name__ == "__main__":
	app = ConcealOverline()
	app.run()

Image

Textual Diagnostics

Versions

Name Value
Textual 3.2.0
Rich 14.0.0

Python

Name Value
Version 3.13.3
Implementation CPython
Compiler GCC 14.2.0
Executable /path/to/my/venv/bin/python3

Operating System

Name Value
System Linux
Release 6.12.25-amd64
Version #1 SMP PREEMPT_DYNAMIC Debian 6.12.25-1 (2025-04-25)

Terminal

Name Value
Terminal Application Unknown
TERM xterm-256color
COLORTERM truecolor
FORCE_COLOR Not set
NO_COLOR Not set

Rich Console options

Name Value
size width=284, height=77
legacy_windows False
min_width 1
max_width 284
is_terminal False
encoding utf-8
max_height 77
justify None
overflow None
no_wrap False
highlight None
markup None
height None

xavierog avatar May 04 '25 13:05 xavierog

Thank you for your issue. Give us a little time to review it.

PS. You might want to check the FAQ if you haven't done so already.

This is an automated reply, generated by FAQtory

github-actions[bot] avatar May 04 '25 13:05 github-actions[bot]

I'm a little reluctant to add those. Overline isn't well supported. Many terminals ignore it. And conceal seems redundant in the context of a TUI.

Did you have a use-case for these styles?

willmcgugan avatar Jun 14 '25 15:06 willmcgugan