Is there any macro or other solution to count the number of characters in a text?
..or, actually, the goal is to set the
height of a a text area editor to match the content. For instance, in the SideEditor opening the sideeditor for a tiddler that has not previously been opened by it (and thus has not saved size values) the editor shows only a few rows, regardless of actual text length.
It's enough with an approximate height for the frame, perhaps +/-10% for longer texts, so my idea is to (somehow) get the number of characters, divide it by a hard coded estimated number of characters in a row (or is there any chance to count characters until line wrap? I'd be surprised!) and divide the two to get a rough estimate for how many lines the editor should show by default.
It seems there are many small
javascript solutions to pick from... but that ain't TW so I don't know how to use it. I'm thinking there might already be a solution for "numbers of characters in a text" in tiddlyverse?
I did find @Skeeves
Wordcount macro and @Jeds
Wordcount - neither of which I get to work (hm!?) and I'd really prefer number of characters rather than the number of words, for this. There's also the steamingly fresh
Count filter by @Tobias which counts number of tiddler titles - again not what I'm hoping for.
Hoping to get pointers or ideas. Thank you!
<:-)