Re: Special logo characters in regex (for Adv find)

2020-12-17 Thread Jürgen Spitzmüller
Am Donnerstag, dem 17.12.2020 um 16:07 +0100 schrieb Kornel Benko:
> Thanks Jürgen. I am lost here. It should behave as if in normal text,
> that is
> display the logo (draw) and insert e.g. \LyX{} in (latex?)_output.
> For instance
>   regexp{\LaTeXe{}\endregexp{}}
> so that the findadv could parse this.

This is probably so,e work to implement. Probably a better way would be
a texted regexp inset.

Jürgen



signature.asc
Description: This is a digitally signed message part
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: Special logo characters in regex (for Adv find)

2020-12-17 Thread Kornel Benko
Am Thu, 17 Dec 2020 15:45:48 +0100
schrieb Jürgen Spitzmüller :

> Am Donnerstag, dem 17.12.2020 um 15:15 +0100 schrieb Kornel Benko:
> > Sorry for being dumb, I saw these already, alas I could not find
> > where the actual decision is made.  
> 
> Like this:
> 
> diff --git a/src/mathed/InsetMathHull.cpp
> b/src/mathed/InsetMathHull.cpp
> index f0df1d90fd..2f7bb40bb8 100644
> --- a/src/mathed/InsetMathHull.cpp
> +++ b/src/mathed/InsetMathHull.cpp
> @@ -2099,6 +2099,11 @@ bool InsetMathHull::getStatus(Cursor & cur,
> FuncRequest const & cmd,
> status.setEnabled(type_ != hullSimple);
> return true;
>  
> +   case LFUN_SPECIALCHAR_INSERT:
> +   if (type_ == hullRegexp)
> +   return true;
> +   return InsetMathGrid::getStatus(cur, cmd, status);
> +
> case LFUN_LABEL_COPY_AS_REFERENCE: {
> bool enabled = false;
> if (cmd.argument().empty() && () == this) {
> 
> 
> But you also need to write a routine for LFUN_SPECIALCHAR_INSERT in
> dispatch() which handles how these insets are inserted.
> 
> Jürgen
> 

Thanks Jürgen. I am lost here. It should behave as if in normal text, that is
display the logo (draw) and insert e.g. \LyX{} in (latex?)_output.
For instance
regexp{\LaTeXe{}\endregexp{}}
so that the findadv could parse this.

Kornel


pgpX2PDDI4rY7.pgp
Description: Digitale Signatur von OpenPGP
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: Special logo characters in regex (for Adv find)

2020-12-17 Thread Jürgen Spitzmüller
Am Donnerstag, dem 17.12.2020 um 15:15 +0100 schrieb Kornel Benko:
> Sorry for being dumb, I saw these already, alas I could not find
> where the actual decision is made.

Like this:

diff --git a/src/mathed/InsetMathHull.cpp
b/src/mathed/InsetMathHull.cpp
index f0df1d90fd..2f7bb40bb8 100644
--- a/src/mathed/InsetMathHull.cpp
+++ b/src/mathed/InsetMathHull.cpp
@@ -2099,6 +2099,11 @@ bool InsetMathHull::getStatus(Cursor & cur,
FuncRequest const & cmd,
status.setEnabled(type_ != hullSimple);
return true;
 
+   case LFUN_SPECIALCHAR_INSERT:
+   if (type_ == hullRegexp)
+   return true;
+   return InsetMathGrid::getStatus(cur, cmd, status);
+
case LFUN_LABEL_COPY_AS_REFERENCE: {
bool enabled = false;
if (cmd.argument().empty() && () == this) {


But you also need to write a routine for LFUN_SPECIALCHAR_INSERT in
dispatch() which handles how these insets are inserted.

Jürgen



signature.asc
Description: This is a digitally signed message part
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: Special logo characters in regex (for Adv find)

2020-12-17 Thread Kornel Benko
Am Thu, 17 Dec 2020 14:02:57 +0100
schrieb Jürgen Spitzmüller :

> Am Donnerstag, dem 17.12.2020 um 12:31 +0100 schrieb Jürgen
> Spitzmüller:
> > InsetMathNest::getStatus()
> > 
> > The regexp inset is a math hull inset, thus restrictions to math
> > apply.
> > You could add an exception to InsetMathHull::getStatus() for
> > InsetSpecialChar and type == hullRegexp for case LFUN_INSET_INSERT.  
> 
> LFUN_SPECIALCHAR_INSERT, for that matter.
> 
> Jürgen

Sorry for being dumb, I saw these already, alas I could not find where the 
actual
decision is made.

Kornel


pgpUAcbnDSygD.pgp
Description: Digitale Signatur von OpenPGP
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: Special logo characters in regex (for Adv find)

2020-12-17 Thread Jürgen Spitzmüller
Am Donnerstag, dem 17.12.2020 um 14:36 +0100 schrieb Jean-Marc
Lasgouttes:
> Was there a real good reason for the regex inset to be a math inset,
> or is just a case of laziness? Is it because it can be inserted in
> math and text?

I suspect laziness. I was also surprised to find it in mathed.

Jürgen

> 
> JMarc



signature.asc
Description: This is a digitally signed message part
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: Special logo characters in regex (for Adv find)

2020-12-17 Thread Jean-Marc Lasgouttes

Le 17/12/2020 à 12:31, Jürgen Spitzmüller a écrit :

The regexp inset is a math hull inset, thus restrictions to math apply.
You could add an exception to InsetMathHull::getStatus() for
InsetSpecialChar and type == hullRegexp for case LFUN_INSET_INSERT.


Was there a real good reason for the regex inset to be a math inset, or 
is just a case of laziness? Is it because it can be inserted in math and 
text?


JMarc
--
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: Special logo characters in regex (for Adv find)

2020-12-17 Thread Jürgen Spitzmüller
Am Donnerstag, dem 17.12.2020 um 12:31 +0100 schrieb Jürgen
Spitzmüller:
> InsetMathNest::getStatus()
> 
> The regexp inset is a math hull inset, thus restrictions to math
> apply.
> You could add an exception to InsetMathHull::getStatus() for
> InsetSpecialChar and type == hullRegexp for case LFUN_INSET_INSERT.

LFUN_SPECIALCHAR_INSERT, for that matter.

Jürgen


signature.asc
Description: This is a digitally signed message part
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: Special logo characters in regex (for Adv find)

2020-12-17 Thread Jürgen Spitzmüller
Am Donnerstag, dem 17.12.2020 um 11:52 +0100 schrieb Kornel Benko:
> I would like to handle the logo characters (\LyX{}, \LaTeX{}, ...) in
> regexes too,
> but
> 1.) It is disabled to paste the chars in regex
> 2.) selecting the part together with the special in search field and
>   applying 'regexp-mode' will change the char to text (LyX,
> LaTeX, ...)
> 
> So the question: where is the responsible code?

InsetMathNest::getStatus()

The regexp inset is a math hull inset, thus restrictions to math apply.
You could add an exception to InsetMathHull::getStatus() for
InsetSpecialChar and type == hullRegexp for case LFUN_INSET_INSERT.

Jürgen



signature.asc
Description: This is a digitally signed message part
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel