xText newline char Thread last updated on 2005-12-11 23:32:51

Posted by member 280260 on 2005-12-10 13:49:59

Is \n a valid escape sequence in xTextEdit? If not, is there some way I can build a newline into an append I'm doing to a file?

(For some context, I'm trying to create a widget that can make copies of itself on the desktop, so I need some way of writing all the code for the new copy into the config file)

Posted by member 248213 on 2005-12-10 14:01:18 link

yes, I have done this with my deskicons component :)

!xTextAppend "\nNewtext"

is how I do it.

Posted by member 280260 on 2005-12-11 19:22:36 link

I did that and all I got was strings of \ns.

Speaking of your deskicons component - I downloaded lock.solid today to try to figure out how you manage component copying - haven't really had a good chance to look at it yet.
I've been trying to do my own component thing for a while (remember the "sticky" post?) with textedit but it's not really working. My problem is that the component I'm copying uses textedit to save its own evars, and I need to do a sort of meta-textedit. But I can't figure out how to stop textedit from parsing the internal @signs, so it's ending in the wrong place and not really doing anything. Is textedit the right module to use for this?

Posted by member 248213 on 2005-12-11 23:32:51 link

yes. with xTextedit-0.5 its doable.

!xTextAppend appends the text on a newline anyway.
so doing this:
!xTextAppend @C:\test.rc@ @appended@
!xTextAppend @C:\test.rc@ @appended@


will result in:
appended
appended


But you are right, the "\n" isnt a xTextedit escape code.
It must be lslua doing that for me ;) And it doesnt really matter, it just makes it easier to read if they have lines seperating the configs.

You can add a blank line with:
!xTextAppend @C:\test.rc@ @@