On 06/04/13 20:04, Kornel Benko wrote:
>> However, when the regexp contains non-ASCII chars, then it's misinterpreted
>> in the text conversion. I suspect it's due to the fact that the regexp inset
>> has been essentially derived from a math inset, so it's not expecting any
>> non-ASCII stuff therein, and it's not applying the
>> regular non-ASCII chars mangling that is instead done correctly for text.
>> I'll try to look into it.

So,

I came up with this trivial patch for the kind of scenario you proposed. Simply,
export an regexp inset using the text, rather than math, "encoding" rules.
AFAICS, one might usefully be willing to write text (and special chars) in a
regexp context.

However, it's not conclusive, nor can it be.

Imagine I write the word you were mentioning (použiť) both as regular text in
a document, AND within a math inset.

Then, I search for it through Advanced Find.

If I enter the word as simple text in the Find box, then it finds only the text
counter-part in the document, but it cannot match the math one. If I enter the
word in math mode, then it's the other way round. If I enter the word in regexp
mode, then I match one or the other depending on whether you applied my attached
patch :-).

Now, such a behaviour might have been OK for Ignore Format unchecked, but it
happens when it's checked as well, and it shouldn't happen.

This is probably one of the many other Advanced Find scenarios that can be
addressed by modifying the export/write/latex logic introducing a special
export mode that carries along the matching options, and lets insets export
what makes sense and is appropriate considering them, rather than trying to
fix the situation through impossible regexp post-processing after the export
(the current implementation is very fragile, if one tries to search for
"{{{", or "\regexp", or a combination of them, or similar, I don't know what
can happen). Such a focused export for advanced F&R should also speed up
tremendously the operation.

comments ?

        T.

diff --git a/src/mathed/InsetMathHull.cpp b/src/mathed/InsetMathHull.cpp
index 7002a9b0..4cfdbca8 100644
--- a/src/mathed/InsetMathHull.cpp
+++ b/src/mathed/InsetMathHull.cpp
@@ -1240,7 +1240,8 @@ docstring InsetMathHull::eolString(row_type row, bool fragile, bool latex,
 
 void InsetMathHull::write(WriteStream & os) const
 {
-	ModeSpecifier specifier(os, MATH_MODE);
+	ModeSpecifier specifier(os,
+		type_ == hullRegexp ? TEXT_MODE : MATH_MODE);
 	header_write(os);
 	InsetMathGrid::write(os);
 	footer_write(os);

Reply via email to