Closed a84r7a3rga76fg closed 6 days ago
What, exactly, is the issue here?
[:20]
is using slicing on the {title}
to extract a sequence starting with the first element to the element with the index 20, what is supposed to "exceed" here?
I'm guessing if {title}
exceeds 20, they want something printed to stdout/as part of the log?
So something similar to :L20/too long/
(docs), but instead of replacing the entire string with "too long", it should still ensure that the string is shorter than the given limit and put an indicator at the end if its length does exceed the limit, e.g. Title Title too long
in this particular example.
edit: this is already possible with f-strings:
"\fF {title if len(title) <= 200 else title[:196] + ' ...'}"
You can now do {title:X20/ .../}
to have title
end with ...
if it is longer than 20 characters.
Is this kind of what you wanted?
Yes, thanks
When the title exceeds 20 i.e.
{title[:20]}
, how do I add something to it to indicate it exceeded 20?