Skip to content

How to move wraped text second line forward in terminal and keep style? #3475

Closed Answered by TomJGooding
AntsForBreakfast asked this question in General
Discussion options

You must be logged in to vote

Sorry I'm afraid I still don't understand what you are asking, but maybe something like this?

from rich.console import Console
from rich.text import Text

TEXT = "There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don't look even slightly believable."

console = Console()

rich_text = Text(TEXT)
wrapped_lines = rich_text.wrap(
    console,
    width=120,  # Replace this with the desired width or the console.width
)

console.print(wrapped_lines[0])
for line in wrapped_lines[1:]:
    console.print("|", line)

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@AntsForBreakfast
Comment options

@TomJGooding
Comment options

Answer selected by AntsForBreakfast
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants