Quoting stephan beal <[EMAIL PROTECTED]>:

> @lyx developers,
>
> i'd look at doing this fix myself, but i'm on a dialup line, paying for
> each minute online, and the lyx tarball is 5M+.
>
> For the Qt interface, it seems it would be trivial to fix the Index Item
> entry dialog to automatically escape any illegal characters, like "_".
>
> QString::replace("_","\\_") should do the trick, and would be trivial to
> add to the slot which handles the OK button (though i don't know if
> that slot has access to the string itself).

Except that this doesn't work in the case where the user added the
backslash already himself.

> Alternately, instead of automatic escaping, a warning dialog explaining
> that the entry contains some illegal char(s) would be acceptable, and
> could be done using Qt::QRegExp with little effort.

That's be the better way out. Or, for the Qt frontend, a QValidator could be
used on the text entry.

> For non-Qt interfaces, std::string's replace() could be used, though it
> requires more work than Qt::String. (But i have no idea if lyx uses the
> STL.)

Sure it does.

> The fact that the dialog allows one to enter invalid data has caused me
> NO END of grief. Adding a single underscore to one index entry causes
> errors in completely unrelated parts of the doc when exporting, and
> tracking down the problem is really difficult (as is shown by my
> frustrated posts on the topic), especially since Idx entries aren't
> visible until clicked on (maybe an Expand/View Index Entries option,
> like the one for Footnotes, is feasible?). IMO a dialog box should not
> allow you to enter data which is itself illegal for the program the
> dialog is serving, especially when it *silently* does so.

I'd think QValidator is the way to go for the Qt interface.

Andre'


Reply via email to