Closed callumenator closed 9 years ago
I knew this would bite me eventually. This potentially might be a large piece of work to test all the text widgets to make sure all follow the same quoting rule. For example just about everything uses {...}
to quote strings for the interpreter so the escape function should deal with that.
I've found this which might help: http://stackoverflow.com/questions/5302120/general-string-quoting-for-tcl
I'll need to set some time aside to look into this better.
It might be ok to just use this escaping function when inserting text into text widgets, since as you say usually {} quoting is what you want. A method to evaluate raw strings would also be handy, leaving it up to the to do any necessary escaping.
(Somewhat related: https://github.com/nomad-software/tkd/blob/master/source/tkd/interpreter/tcl.d#L123 should statically check for zero args and not call format in that case, since any literal format specifiers in the string get picked up as 'lone format specifiers').
The above issue is now solved so i might take another look at this.
Right i think i've tackled this bad boy! See https://github.com/nomad-software/tkd/commit/40423f08f91c4647f2d9e8cdab76ea2e7d532c03 for a run down of changes. Test your stuff and see if this fixes the escaping issue. Many thanks for the escaper function. :+1:
If everything tests as good, i'll close this issue.
Yep everything tests fine for me, thanks a lot. Just a note, the escaper doesn't do anything about non-printing characters (mentioned in the SO link you found), but I don't know if this will be an issue.
Hmmm... i don't think they will be a problem and i don't really know what he means by \nnn escapes for non-printing characters.
so i'll close this and create another release.
outputs In text widget:
Possible solution: Use the following for the escaper:
And insert the text using: