Subj : Auto-indenting wrapped text in a frame
To : Codefenix
From : echicken
Date : Tue Nov 28 2023 06:19 pm
Re: Auto-indenting wrapped text in a frame
By: Codefenix to All on Tue Nov 28 2023 11:51:05
Co> Is there a simple way to automatically pad new lines of text with say, 6
Co> leading whitespaces when wrapping text in a frame (i.e.: word_wrap =
Co> true)?
No, there isn't.
Co> What I'm trying to achieve is adding such an indent to wrapped lines of
Co> dialog in MRC. I added a HH:MM timestamp recently, and think it would look
Co> nicer if the next line began after where the timestamp ended in the
Co> previous line.
You could put the text that you want to align into its own word-wrapped frame:
-frame- -frame----------------------
[HH:MM] [text that might be wrapped]
And then you probably want to use frame.data_height to determine the height after wrapping of that second frame, and use it to set the actual height of that frame, and use it to offset the y position of the next row of content, etc.
The alternative is adding an indentation option to Frame and messing around with the word wrapping logic there. Probably doable but probably a pain.