[LyX/master] Fix change tracking colors with RTL languages (#12923)

Udicoudco udifoglle at gmail.com
Wed Jun 12 10:11:23 UTC 2024


On Wed, Jun 12, 2024 at 10:32 AM Pavel Sanda <sanda at lyx.org> wrote:
>
> On Mon, Jun 10, 2024 at 12:19:18PM +0000, Udi Fogiel wrote:
> > commit a5749b9c1f5c5b42e6d6db7cd9f2aab16bc28f5b
> > Author: Udi Fogiel <ufogiel at lyx.org>
> > Date:   Mon Jun 10 15:19:08 2024 +0300
> >
> >     Fix change tracking colors with RTL languages (#12923)
> > ---
> >  src/LaTeXFeatures.cpp | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/src/LaTeXFeatures.cpp b/src/LaTeXFeatures.cpp
> > index 4a4385fc01..e68f850d0a 100644
> > --- a/src/LaTeXFeatures.cpp
> > +++ b/src/LaTeXFeatures.cpp
> > @@ -208,8 +208,8 @@ static docstring const lyxdot_def = from_ascii(
> >
> >  static docstring const changetracking_xcolor_ulem_base_def = from_ascii(
> >       "%% Change tracking with ulem and xcolor: base macros\n"
> > -     "\\DeclareRobustCommand{\\mklyxadded}[1]{\\bgroup\\color{lyxadded}{}#1\\egroup}\n"
> > -     "\\DeclareRobustCommand{\\mklyxdeleted}[1]{\\bgroup\\color{lyxdeleted}\\mklyxsout{#1}\\egroup}\n"
> > +     "\\DeclareRobustCommand{\\mklyxadded}[1]{\\textcolor{lyxadded}\\bgroup#1\\egroup}\n"
> > +     "\\DeclareRobustCommand{\\mklyxdeleted}[1]{\\textcolor{lyxdeleted}\\bgroup\\mklyxsout{#1}\\egroup}\n"
> >       "\\DeclareRobustCommand{\\mklyxsout}[1]{\\ifx\\\\#1\\else\\sout{#1}\\fi}\n");
> >
> >  static docstring const changetracking_xcolor_ulem_def = from_ascii(
>
> I am sorry if I missed some discussion on ML (please redirect me then),
> but is this patch just RTL related or it can break something in CT
> in "normal" documents?

There was no discussion,  but I explained the reasoning a bit in the bug.
The change is basically reordering of the operations. Start a paragraph
before injecting any color specials into the list, it fixes the problems with
RTL stuff, and it is the recommended way (usually) to go, so I thought
to change it for  all cases.

See https://tex.stackexchange.com/a/589156/264024,
https://tex.stackexchange.com/a/47053/264024,
and enrico's comment here https://tex.stackexchange.com/a/207228/264024
for example.

I just used \textcolor as it basically does \leavevmode\color{...
and this is how greyedout is defined. But giving to it a bit more
thought we should probably use \leavevmode\color instead of
\textcolor in both cases (the fact that it works now with greyedout
is a fluke I think).

Can this change the spacing of existing documents? yes, only if
"show changes in output" is selected, and in most cases the output
should be better.  Does this matter? i.e. do we hold strongly
backwards compatibility of the output of change track?

Udi

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


More information about the lyx-devel mailing list