mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 05:16:21 +00:00
Add InsertOnNewline argument tag
This adds a paragraph break before auto-inserting arguments in flex insets. Useful for specific arguments (particularly ling glosses)
This commit is contained in:
parent
cb6c183225
commit
9e6d22ea9c
@ -12444,6 +12444,59 @@ layout can be automatically inserted.
|
||||
|
||||
\end_layout
|
||||
|
||||
\begin_layout Itemize
|
||||
|
||||
\change_inserted -712698321 1559491402
|
||||
\begin_inset Flex Code
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\change_inserted -712698321 1559490711
|
||||
InsertOnNewline
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
|
||||
\begin_inset Flex Code
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\change_inserted -712698321 1559490703
|
||||
[int=0]
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
If this is set to
|
||||
\begin_inset Flex Code
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\change_inserted -712698321 1559490703
|
||||
1
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
, this argument will be inserted on a new line with
|
||||
\begin_inset Flex Code
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\change_inserted -712698321 1559491402
|
||||
AutoInsert
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
(only available within Flex insets).
|
||||
\end_layout
|
||||
|
||||
\begin_layout Itemize
|
||||
\begin_inset Flex Code
|
||||
status collapsed
|
||||
|
@ -10588,6 +10588,49 @@ e Absatzstil ausgewählt wird.
|
||||
\begin_inset Flex Code
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
InsertOnNewline
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
|
||||
\begin_inset Flex Code
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
[int=0]
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
Wenn dies auf
|
||||
\begin_inset Flex Code
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
1
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
gesetzt ist, wird dieses Argument mit
|
||||
\begin_inset Flex Code
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
AutoInsert
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
auf eine neue Zeile gesetzt (nur mit Flex-Einfügungen verfügbar).
|
||||
\end_layout
|
||||
|
||||
\begin_layout Itemize
|
||||
\begin_inset Flex Code
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
InsertCotext
|
||||
\end_layout
|
||||
|
@ -249,7 +249,7 @@ currentFormat = 75
|
||||
# New InsetLayout and Argument tag NewlineCmd
|
||||
|
||||
# Incremented to format 75, 2 June 2019 by spitz
|
||||
# New Argument tag FreeSpacing
|
||||
# New Argument tags FreeSpacing, InsertOnNewline
|
||||
|
||||
# Do not forget to document format change in Customization
|
||||
# Manual (section "Declaring a new text class").
|
||||
|
@ -1016,6 +1016,7 @@ void Layout::readArgument(Lexer & lex)
|
||||
arg.nodelims = false;
|
||||
arg.autoinsert = false;
|
||||
arg.insertcotext = false;
|
||||
arg.insertonnewline = false;
|
||||
bool error = false;
|
||||
bool finished = false;
|
||||
arg.font = inherit_font;
|
||||
|
@ -106,6 +106,7 @@ public:
|
||||
FontInfo labelfont;
|
||||
bool autoinsert;
|
||||
bool insertcotext;
|
||||
bool insertonnewline;
|
||||
ArgPassThru passthru;
|
||||
docstring pass_thru_chars;
|
||||
bool is_toc_caption;
|
||||
|
@ -2078,6 +2078,10 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
|
||||
Layout::LaTeXArgMap::const_iterator const laend = args.end();
|
||||
for (; lait != laend; ++lait) {
|
||||
Layout::latexarg arg = (*lait).second;
|
||||
if (!inautoarg && arg.insertonnewline && cur.pos() > 0) {
|
||||
FuncRequest cmd2(LFUN_PARAGRAPH_BREAK);
|
||||
lyx::dispatch(cmd2);
|
||||
}
|
||||
if (arg.autoinsert) {
|
||||
// The cursor might have been invalidated by the replaceSelection.
|
||||
cur.buffer()->changed(true);
|
||||
@ -2087,6 +2091,10 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
|
||||
cur.leaveInset(cur.inset());
|
||||
cur.posForward();
|
||||
inautoarg = false;
|
||||
if (arg.insertonnewline && cur.pos() > 0) {
|
||||
FuncRequest cmd2(LFUN_PARAGRAPH_BREAK);
|
||||
lyx::dispatch(cmd2);
|
||||
}
|
||||
}
|
||||
FuncRequest cmd2(LFUN_ARGUMENT_INSERT, (*lait).first);
|
||||
lyx::dispatch(cmd2);
|
||||
|
@ -605,6 +605,7 @@ void InsetLayout::readArgument(Lexer & lex)
|
||||
arg.mandatory = false;
|
||||
arg.autoinsert = false;
|
||||
arg.insertcotext = false;
|
||||
arg.insertonnewline = false;
|
||||
bool error = false;
|
||||
bool finished = false;
|
||||
arg.font = inherit_font;
|
||||
@ -639,6 +640,9 @@ void InsetLayout::readArgument(Lexer & lex)
|
||||
} else if (tok == "insertcotext") {
|
||||
lex.next();
|
||||
arg.insertcotext = lex.getBool();
|
||||
} else if (tok == "insertonnewline") {
|
||||
lex.next();
|
||||
arg.insertonnewline = lex.getBool();
|
||||
} else if (tok == "leftdelim") {
|
||||
lex.next();
|
||||
arg.ldelim = lex.getDocString();
|
||||
|
Loading…
Reference in New Issue
Block a user