mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 19:07:45 +00:00
Small reorganization.
I am not sure I fully understand the pending_newline/unskip_newline logic (which seems mainly related to rtl writing), so I prefer to leave it alone, in the sense that now things go again as in 2.1 until the point where those booleans are used for producing output. If it turns out that a spurious (and unwanted) empty line comes from the previous code, it can be easily corrected later. I am also reintroducing the check about a separator inset at the end of the paragraph, because that is necessary for the plain version.
This commit is contained in:
parent
7145863466
commit
8d8d8e9df6
@ -854,9 +854,7 @@ void TeXOnePar(Buffer const & buf,
|
||||
switch (style.latextype) {
|
||||
case LATEX_ITEM_ENVIRONMENT:
|
||||
case LATEX_LIST_ENVIRONMENT:
|
||||
if (nextpar
|
||||
&& (par.params().depth() < nextpar->params().depth())
|
||||
&& !os.afterParbreak())
|
||||
if (nextpar && par.params().depth() < nextpar->params().depth())
|
||||
pending_newline = true;
|
||||
break;
|
||||
case LATEX_ENVIRONMENT: {
|
||||
@ -871,8 +869,7 @@ void TeXOnePar(Buffer const & buf,
|
||||
// fall through possible
|
||||
default:
|
||||
// we don't need it for the last paragraph!!!
|
||||
// or if the last thing is an environment separator
|
||||
if (nextpar && !os.afterParbreak())
|
||||
if (nextpar)
|
||||
pending_newline = true;
|
||||
}
|
||||
|
||||
@ -950,10 +947,14 @@ void TeXOnePar(Buffer const & buf,
|
||||
if (closing_rtl_ltr_environment)
|
||||
os << "}";
|
||||
|
||||
bool const last_was_separator =
|
||||
par.size() > 0 && par.isEnvSeparator(par.size() - 1);
|
||||
|
||||
if (pending_newline) {
|
||||
if (unskip_newline)
|
||||
// prevent unwanted whitespace
|
||||
os << '%';
|
||||
if (!os.afterParbreak() && !last_was_separator)
|
||||
os << '\n';
|
||||
}
|
||||
|
||||
@ -1018,7 +1019,7 @@ void TeXOnePar(Buffer const & buf,
|
||||
// we don't need a newline for the last paragraph!!!
|
||||
// Note from JMarc: we will re-add a \n explicitly in
|
||||
// TeXEnvironment, because it is needed in this case
|
||||
if (nextpar && !os.afterParbreak()) {
|
||||
if (nextpar && !os.afterParbreak() && !last_was_separator) {
|
||||
// Make sure to start a new line
|
||||
os << breakln;
|
||||
Layout const & next_layout = nextpar->layout();
|
||||
|
Loading…
Reference in New Issue
Block a user