Monday, July 04, 2005

Code2HTML Bug Fix

Corrected a bug in the Code2HTML widget today. Turns out I needed to escape the $ symbol in strings passed to the pbcopy command line utility. In a case where you have something like "$()" in the code stream that is converted, it is removed from the resulting pbpaste command utility. The string "$()" is apparently interpreted as some sort of expression, which in this case results in nothing, and so the string is removed from the pasted output. Fixed the bug by escaping the $ symbol in the output stream.

Kudos to afuna for finding this one.

5 comments:

afuna said...

Sorry again, but I ran into another problem with Code2HTML.

It doesn't seem to copy \" properly. That, is, pasting a code like <a href=\"http://somesitehere\"> gets converted properly (or looks like it, from the display), but when it's copied, I get &lt;a href=\http://somesitehere\&gt;.

Actually, same thing happens when I don't press convert (except that the angle brackets aren't converted, obviously :))

\"\" gets converted to \\, but there's no problem with just ""

Not sure how it acts with other escape characters.


By the way, utterly random (but I hope non-creepy-stalkerish), I hope you enjoyed your vacation! :)

Stacey said...

I'll take a look today. Probably just need to escape the escape character. The strange part is resulting from using the command line utils pbcopy and pbpaste for the copy-n-paste stuff. What I should really do is create a plugin for it that does the copy-n-paste, and I would not have these weird problems.

And yes, we enjoyed our vacation immensely!

Stacey said...

Corrected. Just download the latest version from the Code2HTML homepage. http://www.4haks.net/code2html

afuna said...

Thank you. I appreciate how quickly you fix these things :D

By the way, I noticed that you're working on hiding scrollbars/adding resizability in the next version. I'm wondering whether the Stretcher code for the widget, with the scrollbar only appearing in the stretched version, might have a similar effect. (I tried poking around the scrollbar code in my spare time, to see how hiding the scrollbar could be done, and all I managed to do was make a weird bug that shifts the recognized area of the scrollbar down and right whenever I hit a button after it reappears *coughs*)

Got the new version and it's working perfectly now! ♥

Now all I need to do is add in my pre/code wrapper tags, and try to figure out a way to let preferences persist across instantiation of new instances, and I'm all set.

Thank you. Thank you! <-- non-stalkerish, non-creepy admiration

Stacey said...

Glad I can help. MOst bugs are a result of me not testing enough, so I am grateful for a tester. I use this widget too, so it benefits me as much as it does you to get bugs fixed quickly. Hopefully, I'll get some time this week to put in some effort toward features.