>> - docstring const & name = getParam("name");
>> + string url = to_utf8(getParam("target"));
> This is wrong. String processing must not be done with utf8 encoded
> strings. It can fail in many ways, for example url.length() may not be
> equal to the number of characters.
But I don't use a .length() call to avoid this.
> If you do any string processing, do it with docstrings, this is safe.
I couldn't get to make .find() work with docstrings.
Could you implement this?
> Besides, this is a file format change and needs lyx2lyx support. For
> example, a previously escaped "\%" needs to be changed to an
> unescaped "%".
No, the LyX-file itself is not touched, only the LaTeX-output. And former URL stuff will be
converted in lyx2lyx to the new URL layout style. Richard will add this lyx2lyx routine.
> I saw your comment that Richard would do some (other?) lyx2lyx stuff, but
> not long ago there was a rule that no file format change was allowed to go
> in without lyx2lyx in the same patch. If this rule has been dropped it was
> a very bad idea IMHO.
I already committed lyx2lyx stuff: http://www.lyx.org/trac/changeset/20950
Richard will adopt the covert routine for the layout conversion. So basically nothing is broken. I
think using SVN this way, that somebody is allowed to check in something that basically works and it
could be fine tuned bit by bit later is an advantage. We did e.g. the same with Pavel's new hyperref
support and I liked that I could fix it bit by bit the next days. Of course when we start to provide
prereleases, this is not suitable.
> Finally, the code looks very ad hoc, and I would almost bet that it
> contains a bug.
The find and replace routine is taken from C++ books, so why should it not work? Report me a
problem, and I'll fix it.
> Why don't you use the existing, bug free escaping code that is used for
normal text?
What do you mean? I couldn't find a dialog where the text of the fields is treated like text in the
work area. Treating the dialog text as we do in the work area is only usable for the name field, for
the url field, only two characters must be escaped, the rest is allowed by \href.
There must be a reason why this bug was open so long, btw.
But anyway, every improvement is welcome!
thanks for having a look
regards Uwe
p.s. I'm off by now for a week.