Re: [LyX/master] Assure correct spacing of colored items in mathed

2021-02-08 Thread Enrico Forestieri
On Mon, Feb 08, 2021 at 02:23:38PM +0100, Jean-Marc Lasgouttes wrote:
> Le 07/02/2021 à 17:42, Enrico Forestieri a écrit :
> > It's InsetArgumentProxy that is returning MC_UNKNOWN.
> 
> Fixed at c3114515180d. I am not sure though what this code is doing: when
> creating the color inset, there is no \mathxxx anywhere, but they are
> introduced when writing back the .lyx file, right? This feels strange to me.

Why do you have that naïve feeling? Don't you see they magically disappear
when writing back the .lyx file?

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


Re: [LyX/master] Assure correct spacing of colored items in mathed

2021-02-08 Thread Jean-Marc Lasgouttes

Le 07/02/2021 à 17:42, Enrico Forestieri a écrit :

It's InsetArgumentProxy that is returning MC_UNKNOWN.


Fixed at c3114515180d. I am not sure though what this code is doing: 
when creating the color inset, there is no \mathxxx anywhere, but they 
are introduced when writing back the .lyx file, right? This feels 
strange to me.


JMarc

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


Re: [LyX/master] Assure correct spacing of colored items in mathed

2021-02-07 Thread Scott Kostyshak
On Sun, Feb 07, 2021 at 09:37:57AM +0100, Enrico Forestieri wrote:
> On Sat, Feb 06, 2021 at 11:06:41PM -0500, Scott Kostyshak wrote:
> > I see an assertion on master that I think started happening with this 
> > commit.
> > 
> > Here's the assertion:
> > ASSERTION false VIOLATED IN 
> > /home/scott/lyxbuilds/master/repo/src/mathed/MathClass.cpp:59
> > 
> > The assertion happens when I just open the attached file.
> > 
> > Can you reproduce?
> 
> Yes, I can. Thanks for the report. Attached you find two patches.
> 
> The first is the right one, IMHO, but JMarc should tell whether the
> "LATEST(false);" has to remain, instead (note that the assertion only
> triggers in devel mode and is ignored in release mode).

Tested and works well. Thanks for the quick potential fix.

Scott


> The second one is to be used if the first one cannot be applied. This
> patch simply assigns the string "mathord" that would be assigned without
> the assert in class_to_string().
> 
> -- 
> Enrico


signature.asc
Description: PGP signature
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [LyX/master] Assure correct spacing of colored items in mathed

2021-02-07 Thread Enrico Forestieri
On Sun, Feb 07, 2021 at 01:06:15PM +0100, Jean-Marc Lasgouttes wrote:
> Le 07/02/2021 à 09:37, Enrico Forestieri a écrit :
> > On Sat, Feb 06, 2021 at 11:06:41PM -0500, Scott Kostyshak wrote:
> > > I see an assertion on master that I think started happening with this 
> > > commit.
> > > 
> > > Here's the assertion:
> > > ASSERTION false VIOLATED IN 
> > > /home/scott/lyxbuilds/master/repo/src/mathed/MathClass.cpp:59
> > > 
> > > The assertion happens when I just open the attached file.
> > > 
> > > Can you reproduce?
> > 
> > Yes, I can. Thanks for the report. Attached you find two patches.
> > 
> > The first is the right one, IMHO, but JMarc should tell whether the
> > "LATEST(false);" has to remain, instead (note that the assertion only
> > triggers in devel mode and is ignored in release mode).
> 
> What I do not get is why there is a MC_UNKNOWN class. Do you have a hint?

It's InsetArgumentProxy that is returning MC_UNKNOWN.

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


Re: [LyX/master] Assure correct spacing of colored items in mathed

2021-02-07 Thread Jean-Marc Lasgouttes

Le 07/02/2021 à 09:37, Enrico Forestieri a écrit :

On Sat, Feb 06, 2021 at 11:06:41PM -0500, Scott Kostyshak wrote:

I see an assertion on master that I think started happening with this commit.

Here's the assertion:
ASSERTION false VIOLATED IN 
/home/scott/lyxbuilds/master/repo/src/mathed/MathClass.cpp:59

The assertion happens when I just open the attached file.

Can you reproduce?


Yes, I can. Thanks for the report. Attached you find two patches.

The first is the right one, IMHO, but JMarc should tell whether the
"LATEST(false);" has to remain, instead (note that the assertion only
triggers in devel mode and is ignored in release mode).


What I do not get is why there is a MC_UNKNOWN class. Do you have a hint?

JMarc

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


Re: [LyX/master] Assure correct spacing of colored items in mathed

2021-02-07 Thread Enrico Forestieri
On Sat, Feb 06, 2021 at 11:06:41PM -0500, Scott Kostyshak wrote:
> I see an assertion on master that I think started happening with this commit.
> 
> Here's the assertion:
> ASSERTION false VIOLATED IN 
> /home/scott/lyxbuilds/master/repo/src/mathed/MathClass.cpp:59
> 
> The assertion happens when I just open the attached file.
> 
> Can you reproduce?

Yes, I can. Thanks for the report. Attached you find two patches.

The first is the right one, IMHO, but JMarc should tell whether the
"LATEST(false);" has to remain, instead (note that the assertion only
triggers in devel mode and is ignored in release mode).

The second one is to be used if the first one cannot be applied. This
patch simply assigns the string "mathord" that would be assigned without
the assert in class_to_string().

-- 
Enrico
diff --git a/src/mathed/MathClass.cpp b/src/mathed/MathClass.cpp
index 1d352cd746..98ab22e45c 100644
--- a/src/mathed/MathClass.cpp
+++ b/src/mathed/MathClass.cpp
@@ -56,7 +56,6 @@ docstring const class_to_string(MathClass const mc)
s = "mathinner";
break;
case MC_UNKNOWN:
-   LATTEST(false);
s = "mathord";
}
return from_ascii(s);
diff --git a/src/mathed/InsetMathColor.cpp b/src/mathed/InsetMathColor.cpp
index f2f9116bf9..5714fdec5e 100644
--- a/src/mathed/InsetMathColor.cpp
+++ b/src/mathed/InsetMathColor.cpp
@@ -99,10 +99,12 @@ void InsetMathColor::write(TeXMathStream & os) const
// We have to ensure correct spacing when the front and/or back
// atoms are not ordinary ones (bug 11827).
docstring const frontclass =
-   !cell(0).empty() ? class_to_string(cell(0).front()->mathClass())
+   !cell(0).empty() && cell(0).front()->mathClass() != MC_UNKNOWN
+  ? class_to_string(cell(0).front()->mathClass())
   : from_ascii("mathord");
docstring const backclass =
-   !cell(0).empty() ? class_to_string(cell(0).back()->mathClass())
+   !cell(0).empty() && cell(0).front()->mathClass() != MC_UNKNOWN
+  ? class_to_string(cell(0).back()->mathClass())
   : from_ascii("mathord");
bool adjchk = os.latex() && !os.inMathClass() && (normalcolor(color_) 
|| oldstyle_);
bool adjust_front = frontclass != "mathord" && adjchk;
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [LyX/master] Assure correct spacing of colored items in mathed

2021-02-06 Thread Scott Kostyshak
On Sun, Aug 02, 2020 at 06:38:06PM +0200, Enrico Forestieri wrote:
> commit 7441172d4d9a26eb4824bb8bee003f457ef34f1c
> Author: Enrico Forestieri 
> Date:   Sun Aug 2 18:58:40 2020 +0200
> 
> Assure correct spacing of colored items in mathed
> 
> When coloring a non-ordinary math atom, explicitly apply its
> math class, so that to leave unchanged the spacing around it.
> Fixes #11827.
> ---

I see an assertion on master that I think started happening with this commit.

Here's the assertion:
ASSERTION false VIOLATED IN 
/home/scott/lyxbuilds/master/repo/src/mathed/MathClass.cpp:59

The assertion happens when I just open the attached file.

Can you reproduce?

Scott


mwe.23.lyx
Description: application/lyx


signature.asc
Description: PGP signature
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel