mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 13:18:28 +00:00
New InsetLayout tag ParbreakIgnored
This effectively allow paragraph breaks in insets only for cosmetic reasons (e.g., to align contents on different lines). This is the last change necessary for an enhanced covington gloss support (which uses the new covington gloss ui)
This commit is contained in:
parent
9e6d22ea9c
commit
c7efb677f8
@ -20936,6 +20936,74 @@ InsetLayout
|
|||||||
\end_inset
|
\end_inset
|
||||||
|
|
||||||
, while keeping backward compatibility.
|
, while keeping backward compatibility.
|
||||||
|
\change_inserted -712698321 1559491850
|
||||||
|
|
||||||
|
\end_layout
|
||||||
|
|
||||||
|
\begin_layout Description
|
||||||
|
|
||||||
|
\change_inserted -712698321 1559492002
|
||||||
|
\begin_inset Flex Code
|
||||||
|
status collapsed
|
||||||
|
|
||||||
|
\begin_layout Plain Layout
|
||||||
|
|
||||||
|
\change_inserted -712698321 1559491854
|
||||||
|
ParbreakIgnored
|
||||||
|
\end_layout
|
||||||
|
|
||||||
|
\end_inset
|
||||||
|
|
||||||
|
[
|
||||||
|
\begin_inset Flex Code
|
||||||
|
status collapsed
|
||||||
|
|
||||||
|
\begin_layout Plain Layout
|
||||||
|
|
||||||
|
\change_inserted -712698321 1559491850
|
||||||
|
|
||||||
|
\emph on
|
||||||
|
0
|
||||||
|
\end_layout
|
||||||
|
|
||||||
|
\end_inset
|
||||||
|
|
||||||
|
,
|
||||||
|
\begin_inset space \thinspace{}
|
||||||
|
\end_inset
|
||||||
|
|
||||||
|
|
||||||
|
\begin_inset Flex Code
|
||||||
|
status collapsed
|
||||||
|
|
||||||
|
\begin_layout Plain Layout
|
||||||
|
|
||||||
|
\change_inserted -712698321 1559491850
|
||||||
|
1
|
||||||
|
\end_layout
|
||||||
|
|
||||||
|
\end_inset
|
||||||
|
|
||||||
|
] If this is set to
|
||||||
|
\begin_inset Flex Code
|
||||||
|
status collapsed
|
||||||
|
|
||||||
|
\begin_layout Plain Layout
|
||||||
|
|
||||||
|
\change_inserted -712698321 1559491881
|
||||||
|
1
|
||||||
|
\change_unchanged
|
||||||
|
|
||||||
|
\end_layout
|
||||||
|
|
||||||
|
\end_inset
|
||||||
|
|
||||||
|
, paragraph breaks will be ignored in the output.
|
||||||
|
This might be useful for insets where the content should be alignable on
|
||||||
|
different lines only in the \SpecialChar LyX
|
||||||
|
workarea, without any effect in the output.
|
||||||
|
\change_unchanged
|
||||||
|
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\begin_layout Description
|
\begin_layout Description
|
||||||
|
@ -18948,6 +18948,55 @@ InsetLayout
|
|||||||
\begin_inset Flex Code
|
\begin_inset Flex Code
|
||||||
status collapsed
|
status collapsed
|
||||||
|
|
||||||
|
\begin_layout Plain Layout
|
||||||
|
ParbreakIgnored
|
||||||
|
\end_layout
|
||||||
|
|
||||||
|
\end_inset
|
||||||
|
|
||||||
|
[
|
||||||
|
\begin_inset Flex Code
|
||||||
|
status collapsed
|
||||||
|
|
||||||
|
\begin_layout Plain Layout
|
||||||
|
|
||||||
|
\emph on
|
||||||
|
0
|
||||||
|
\end_layout
|
||||||
|
|
||||||
|
\end_inset
|
||||||
|
|
||||||
|
,
|
||||||
|
\begin_inset Flex Code
|
||||||
|
status collapsed
|
||||||
|
|
||||||
|
\begin_layout Plain Layout
|
||||||
|
1
|
||||||
|
\end_layout
|
||||||
|
|
||||||
|
\end_inset
|
||||||
|
|
||||||
|
] Wenn dies auf
|
||||||
|
\begin_inset Flex Code
|
||||||
|
status collapsed
|
||||||
|
|
||||||
|
\begin_layout Plain Layout
|
||||||
|
1
|
||||||
|
\end_layout
|
||||||
|
|
||||||
|
\end_inset
|
||||||
|
|
||||||
|
gesetzt wird, werden Absatzwechsel in der Ausgabe ignoriert.
|
||||||
|
Das kann dann sinnvoll sein, wenn der Inhalt von Einfügungen im \SpecialChar LyX
|
||||||
|
-Arbeitsbereich
|
||||||
|
auf verschiedenen Zeilen angeordnet werden soll, ohne dass dies eine Wirkung
|
||||||
|
in der Ausgabe hat.
|
||||||
|
\end_layout
|
||||||
|
|
||||||
|
\begin_layout Description
|
||||||
|
\begin_inset Flex Code
|
||||||
|
status collapsed
|
||||||
|
|
||||||
\begin_layout Plain Layout
|
\begin_layout Plain Layout
|
||||||
ParbreakIsNewline
|
ParbreakIsNewline
|
||||||
\end_layout
|
\end_layout
|
||||||
|
@ -250,6 +250,7 @@ currentFormat = 75
|
|||||||
|
|
||||||
# Incremented to format 75, 2 June 2019 by spitz
|
# Incremented to format 75, 2 June 2019 by spitz
|
||||||
# New Argument tags FreeSpacing, InsertOnNewline
|
# New Argument tags FreeSpacing, InsertOnNewline
|
||||||
|
# New InsetLayout tag ParbreakIgnored
|
||||||
|
|
||||||
# Do not forget to document format change in Customization
|
# Do not forget to document format change in Customization
|
||||||
# Manual (section "Declaring a new text class").
|
# Manual (section "Declaring a new text class").
|
||||||
|
@ -330,6 +330,8 @@ namespace {
|
|||||||
|
|
||||||
docstring parbreak(CursorData const * cur)
|
docstring parbreak(CursorData const * cur)
|
||||||
{
|
{
|
||||||
|
if (cur->inset().getLayout().parbreakIgnored())
|
||||||
|
return docstring();
|
||||||
odocstringstream os;
|
odocstringstream os;
|
||||||
os << '\n';
|
os << '\n';
|
||||||
// only add blank line if we're not in a ParbreakIsNewline situation
|
// only add blank line if we're not in a ParbreakIsNewline situation
|
||||||
|
@ -41,7 +41,7 @@ InsetLayout::InsetLayout() :
|
|||||||
fixedwidthpreambleencoding_(false), htmlforcecss_ (false),
|
fixedwidthpreambleencoding_(false), htmlforcecss_ (false),
|
||||||
htmlisblock_(true), multipar_(true), custompars_(true),
|
htmlisblock_(true), multipar_(true), custompars_(true),
|
||||||
forceplain_(false), passthru_(false), parbreakisnewline_(false),
|
forceplain_(false), passthru_(false), parbreakisnewline_(false),
|
||||||
freespacing_(false), keepempty_(false), forceltr_(false),
|
parbreakignored_(false), freespacing_(false), keepempty_(false), forceltr_(false),
|
||||||
forceownlines_(false), needprotect_(false), needcprotect_(false),
|
forceownlines_(false), needprotect_(false), needcprotect_(false),
|
||||||
needmboxprotect_(false), intoc_(false), spellcheck_(true),
|
needmboxprotect_(false), intoc_(false), spellcheck_(true),
|
||||||
resetsfont_(false), display_(true), forcelocalfontswitch_(false),
|
resetsfont_(false), display_(true), forcelocalfontswitch_(false),
|
||||||
@ -128,6 +128,7 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass)
|
|||||||
IL_NEWLINE_CMD,
|
IL_NEWLINE_CMD,
|
||||||
IL_PASSTHRU,
|
IL_PASSTHRU,
|
||||||
IL_PASSTHRU_CHARS,
|
IL_PASSTHRU_CHARS,
|
||||||
|
IL_PARBREAKIGNORED,
|
||||||
IL_PARBREAKISNEWLINE,
|
IL_PARBREAKISNEWLINE,
|
||||||
IL_PREAMBLE,
|
IL_PREAMBLE,
|
||||||
IL_REQUIRES,
|
IL_REQUIRES,
|
||||||
@ -187,6 +188,7 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass)
|
|||||||
{ "needprotect", IL_NEEDPROTECT },
|
{ "needprotect", IL_NEEDPROTECT },
|
||||||
{ "newlinecmd", IL_NEWLINE_CMD },
|
{ "newlinecmd", IL_NEWLINE_CMD },
|
||||||
{ "obsoletedby", IL_OBSOLETEDBY },
|
{ "obsoletedby", IL_OBSOLETEDBY },
|
||||||
|
{ "parbreakignored", IL_PARBREAKIGNORED },
|
||||||
{ "parbreakisnewline", IL_PARBREAKISNEWLINE },
|
{ "parbreakisnewline", IL_PARBREAKISNEWLINE },
|
||||||
{ "passthru", IL_PASSTHRU },
|
{ "passthru", IL_PASSTHRU },
|
||||||
{ "passthruchars", IL_PASSTHRU_CHARS },
|
{ "passthruchars", IL_PASSTHRU_CHARS },
|
||||||
@ -327,6 +329,9 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass)
|
|||||||
case IL_NEWLINE_CMD:
|
case IL_NEWLINE_CMD:
|
||||||
lex >> newline_cmd_;
|
lex >> newline_cmd_;
|
||||||
break;
|
break;
|
||||||
|
case IL_PARBREAKIGNORED:
|
||||||
|
lex >> parbreakignored_;
|
||||||
|
break;
|
||||||
case IL_PARBREAKISNEWLINE:
|
case IL_PARBREAKISNEWLINE:
|
||||||
lex >> parbreakisnewline_;
|
lex >> parbreakisnewline_;
|
||||||
break;
|
break;
|
||||||
|
@ -164,6 +164,8 @@ public:
|
|||||||
///
|
///
|
||||||
bool parbreakIsNewline() const { return parbreakisnewline_; }
|
bool parbreakIsNewline() const { return parbreakisnewline_; }
|
||||||
///
|
///
|
||||||
|
bool parbreakIgnored() const { return parbreakignored_; }
|
||||||
|
///
|
||||||
bool isNeedProtect() const { return needprotect_; }
|
bool isNeedProtect() const { return needprotect_; }
|
||||||
///
|
///
|
||||||
bool needsCProtect() const { return needcprotect_; }
|
bool needsCProtect() const { return needcprotect_; }
|
||||||
@ -289,6 +291,8 @@ private:
|
|||||||
///
|
///
|
||||||
bool parbreakisnewline_;
|
bool parbreakisnewline_;
|
||||||
///
|
///
|
||||||
|
bool parbreakignored_;
|
||||||
|
///
|
||||||
bool freespacing_;
|
bool freespacing_;
|
||||||
///
|
///
|
||||||
bool keepempty_;
|
bool keepempty_;
|
||||||
|
@ -763,7 +763,7 @@ void TeXOnePar(Buffer const & buf,
|
|||||||
Font const outerfont = text.outerFont(pit);
|
Font const outerfont = text.outerFont(pit);
|
||||||
|
|
||||||
// No newline before first paragraph in this lyxtext
|
// No newline before first paragraph in this lyxtext
|
||||||
if (pit > 0) {
|
if (pit > 0 && !text.inset().getLayout().parbreakIgnored()) {
|
||||||
os << '\n';
|
os << '\n';
|
||||||
if (!text.inset().getLayout().parbreakIsNewline())
|
if (!text.inset().getLayout().parbreakIsNewline())
|
||||||
os << '\n';
|
os << '\n';
|
||||||
@ -1135,7 +1135,7 @@ void TeXOnePar(Buffer const & buf,
|
|||||||
&& nextpar->getDepth() < par.getDepth()))
|
&& nextpar->getDepth() < par.getDepth()))
|
||||||
close_lang_switch = using_begin_end;
|
close_lang_switch = using_begin_end;
|
||||||
if (nextpar && par.params().depth() < nextpar->params().depth())
|
if (nextpar && par.params().depth() < nextpar->params().depth())
|
||||||
pending_newline = true;
|
pending_newline = !text.inset().getLayout().parbreakIgnored();
|
||||||
break;
|
break;
|
||||||
case LATEX_ENVIRONMENT: {
|
case LATEX_ENVIRONMENT: {
|
||||||
// if it's the last paragraph of the current environment
|
// if it's the last paragraph of the current environment
|
||||||
@ -1154,7 +1154,7 @@ void TeXOnePar(Buffer const & buf,
|
|||||||
default:
|
default:
|
||||||
// we don't need it for the last paragraph and in InTitle commands!!!
|
// we don't need it for the last paragraph and in InTitle commands!!!
|
||||||
if (nextpar && !intitle_command)
|
if (nextpar && !intitle_command)
|
||||||
pending_newline = true;
|
pending_newline = !text.inset().getLayout().parbreakIgnored();
|
||||||
}
|
}
|
||||||
|
|
||||||
// InTitle commands use switches (not environments) for space settings
|
// InTitle commands use switches (not environments) for space settings
|
||||||
@ -1225,7 +1225,8 @@ void TeXOnePar(Buffer const & buf,
|
|||||||
localswitch)
|
localswitch)
|
||||||
: subst(lang_begin_command, "$$lang", current_lang);
|
: subst(lang_begin_command, "$$lang", current_lang);
|
||||||
os << bc;
|
os << bc;
|
||||||
pending_newline = !localswitch;
|
pending_newline = !localswitch
|
||||||
|
&& !text.inset().getLayout().parbreakIgnored();
|
||||||
unskip_newline = !localswitch;
|
unskip_newline = !localswitch;
|
||||||
if (using_begin_end)
|
if (using_begin_end)
|
||||||
pushLanguageName(current_lang, localswitch);
|
pushLanguageName(current_lang, localswitch);
|
||||||
@ -1255,7 +1256,8 @@ void TeXOnePar(Buffer const & buf,
|
|||||||
lang_end_command,
|
lang_end_command,
|
||||||
"$$lang",
|
"$$lang",
|
||||||
par_lang));
|
par_lang));
|
||||||
pending_newline = !localswitch;
|
pending_newline = !localswitch
|
||||||
|
&& !text.inset().getLayout().parbreakIgnored();
|
||||||
unskip_newline = !localswitch;
|
unskip_newline = !localswitch;
|
||||||
if (using_begin_end)
|
if (using_begin_end)
|
||||||
popLanguageName();
|
popLanguageName();
|
||||||
@ -1370,9 +1372,10 @@ void TeXOnePar(Buffer const & buf,
|
|||||||
// Note from JMarc: we will re-add a \n explicitly in
|
// Note from JMarc: we will re-add a \n explicitly in
|
||||||
// TeXEnvironment, because it is needed in this case
|
// TeXEnvironment, because it is needed in this case
|
||||||
if (nextpar && !os.afterParbreak() && !last_was_separator) {
|
if (nextpar && !os.afterParbreak() && !last_was_separator) {
|
||||||
// Make sure to start a new line
|
|
||||||
os << breakln;
|
|
||||||
Layout const & next_layout = nextpar->layout();
|
Layout const & next_layout = nextpar->layout();
|
||||||
|
if (!text.inset().getLayout().parbreakIgnored())
|
||||||
|
// Make sure to start a new line
|
||||||
|
os << breakln;
|
||||||
// A newline '\n' is always output before a command,
|
// A newline '\n' is always output before a command,
|
||||||
// so avoid doubling it.
|
// so avoid doubling it.
|
||||||
if (!next_layout.isCommand()) {
|
if (!next_layout.isCommand()) {
|
||||||
@ -1396,6 +1399,7 @@ void TeXOnePar(Buffer const & buf,
|
|||||||
if ((style == next_layout
|
if ((style == next_layout
|
||||||
&& !style.parbreak_is_newline
|
&& !style.parbreak_is_newline
|
||||||
&& !text.inset().getLayout().parbreakIsNewline()
|
&& !text.inset().getLayout().parbreakIsNewline()
|
||||||
|
&& !text.inset().getLayout().parbreakIgnored()
|
||||||
&& style.latextype != LATEX_ITEM_ENVIRONMENT
|
&& style.latextype != LATEX_ITEM_ENVIRONMENT
|
||||||
&& style.latextype != LATEX_LIST_ENVIRONMENT
|
&& style.latextype != LATEX_LIST_ENVIRONMENT
|
||||||
&& style.align == par.getAlign()
|
&& style.align == par.getAlign()
|
||||||
|
Loading…
Reference in New Issue
Block a user