fix for panel title

This commit is contained in:
Will McGugan 2024-07-01 11:38:23 +01:00
parent 26479c17e9
commit 7a38204cb5

View file

@ -144,7 +144,8 @@ class Panel(JupyterMixin):
Padding(self.renderable, _padding) if any(_padding) else self.renderable Padding(self.renderable, _padding) if any(_padding) else self.renderable
) )
style = console.get_style(self.style) style = console.get_style(self.style)
border_style = style + console.get_style(self.border_style) partial_border_style = console.get_style(self.border_style)
border_style = style + partial_border_style
width = ( width = (
options.max_width options.max_width
if self.width is None if self.width is None
@ -200,7 +201,7 @@ class Panel(JupyterMixin):
title_text = self._title title_text = self._title
if title_text is not None: if title_text is not None:
title_text.stylize_before(border_style) title_text.stylize_before(partial_border_style)
child_width = ( child_width = (
width - 2 width - 2
@ -249,7 +250,7 @@ class Panel(JupyterMixin):
subtitle_text = self._subtitle subtitle_text = self._subtitle
if subtitle_text is not None: if subtitle_text is not None:
subtitle_text.stylize_before(border_style) subtitle_text.stylize_before(partial_border_style)
if subtitle_text is None or width <= 4: if subtitle_text is None or width <= 4:
yield Segment(box.get_bottom([width - 2]), border_style) yield Segment(box.get_bottom([width - 2]), border_style)