mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-10 20:04:46 +00:00
Make tex2lyx tests green again
Unfortunately I overlooked in 44f73b0650
that the first three whitespace
changes in box-color-size-space-align.lyx.lyx were actually correct, so they
should not have been reverted. In detail:
1), 2): The space after \raggedleft must not be part of the ERT inset, but it
is ouput by check_space() as part of the standard text which follows.
3): The space in front of www is caused by the fact that there is a
newline between the opening brace of the parbox and the \centering
command, so this space is not the one after \centering (which is
correctly swallowed). This additional space is in fact not needed,
and the contents would look better in LyX without it, but since it is
not caused by special code I'll put it back in the refernce for now.
We can still improve this in the future if anybody has a good idea.
The remaining whitespace issues are all fixed by a simple change in
parse_text(): Instead of always eating whitespace after detecting \centering
et al, and always output a space as part of the ERT if these commands need an
ERT, let the standard space handling mechanism kick in: skip whitespace if
no ERT is used (in this case LyX will always output the needed space), and
do not touch whitespace if an ERT is used.
This commit is contained in:
parent
0cd7d1f699
commit
6f84ceb821
@ -1350,12 +1350,12 @@ status collapsed
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\backslash
|
||||
raggedleft
|
||||
raggedleft
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
|
||||
|
||||
\begin_inset Box Frameless
|
||||
position "t"
|
||||
hor_pos "c"
|
||||
@ -1376,7 +1376,7 @@ status open
|
||||
|
||||
|
||||
\begin_layout Plain Layout
|
||||
www
|
||||
www
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
@ -4289,7 +4289,6 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
|
||||
|| t.cs() == "shadowsize"
|
||||
|| t.cs() == "raggedleft" || t.cs() == "centering"
|
||||
|| t.cs() == "raggedright") {
|
||||
p.skip_spaces(true);
|
||||
if (t.cs() == "fboxrule")
|
||||
fboxrule = "";
|
||||
if (t.cs() == "fboxsep")
|
||||
@ -4298,6 +4297,7 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
|
||||
shadow_size = "";
|
||||
if (t.cs() != "raggedleft" && t.cs() != "centering"
|
||||
&& t.cs() != "raggedright") {
|
||||
p.skip_spaces(true);
|
||||
while (p.good() && p.next_token().cat() != catSpace
|
||||
&& p.next_token().cat() != catNewline
|
||||
&& p.next_token().cat() != catEscape) {
|
||||
@ -4310,8 +4310,14 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
|
||||
}
|
||||
} else {
|
||||
// we only handle them if they are in a box
|
||||
if (!wasBoxAlign)
|
||||
output_ert_inset(os, '\\' + t.cs() + ' ', context);
|
||||
if (wasBoxAlign) {
|
||||
// LyX will add a space after outputting the
|
||||
// alignment command, so eat any space which
|
||||
// might follow. Otherwise the paragraph
|
||||
// might start with an unneeded space.
|
||||
p.skip_spaces(true);
|
||||
} else
|
||||
output_ert_inset(os, t.asInput(), context);
|
||||
}
|
||||
wasBoxAlign = false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user