Page 2 of 2

Re: fText, the text formatting library

Posted: Mon May 04, 2020 2:09 am
by Thodak
Thanks for the response @demonnic. I tried this but it didn't work:
Code: [show] | [select all] lua
myFormatter = demonnic.TextFormatter:new( {
  width = 40, 
  cap = "[CAP]",
  capColor = "<white>",
  textColor = "<light_blue>"
})

myFormatter:setType('h')

myFormatter:setCapColor("#9AC48D")
Can you help me figure out what I'm missing?

Re: fText, the text formatting library

Posted: Mon May 04, 2020 4:09 am
by demonnic
how are you echoing the information? Also, I see some places where I can improve this for an upcoming version

Re: fText, the text formatting library

Posted: Tue May 26, 2020 6:59 pm
by demonnic
I could have sworn I made a post here about this but... released 1.3.0! https://github.com/demonnic/fText/tree/1.3.0

Mainly, this is a fix for word wrapping coloured lines. It should be much more intelligent about that now.

If you are using demonnic:wordWrap directly, you should change it to demonnic.wordWrap with this version.
If you want to word wrap text with colour codes, use demonnic.xwrap(str, width, type) where type is 'c' for cecho text, 'd' for decho text, and 'h' for hecho text. If you do not pass a type in, then xwrap quietly passes the information along to the old wordWrap function and returns that.