diff --git a/lib/doc/Customization.lyx b/lib/doc/Customization.lyx index cef51f803b..d27349cd2e 100644 --- a/lib/doc/Customization.lyx +++ b/lib/doc/Customization.lyx @@ -13050,6 +13050,8 @@ status collapsed \change_inserted -712698321 1723455730 EscapeChars +\change_unchanged + \end_layout \end_inset @@ -13062,6 +13064,8 @@ status collapsed \change_inserted -712698321 1723455616 string +\change_unchanged + \end_layout \end_inset @@ -19776,6 +19780,8 @@ status collapsed \change_inserted -712698321 1723455884 EscapeChars +\change_unchanged + \end_layout \end_inset @@ -19788,6 +19794,8 @@ status collapsed \change_inserted -712698321 1723455884 string +\change_unchanged + \end_layout \end_inset @@ -20250,6 +20258,82 @@ status collapsed export if this parameter is 1, as well as on screen. Otherwise the document default font is used. +\change_inserted -712698321 1723525171 + +\end_layout + +\begin_layout Description + +\change_inserted -712698321 1723526674 +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout + +\change_inserted -712698321 1723525171 +InsertCotext +\end_layout + +\end_inset + + +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout + +\change_inserted -712698321 1723525183 +[ +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout + +\change_inserted -712698321 1723525183 +0 +\end_layout + +\end_inset + +, +\begin_inset space \thinspace{} +\end_inset + + +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout + +\change_inserted -712698321 1723525183 + +\emph on +1 +\end_layout + +\end_inset + +] +\end_layout + +\end_inset + + If this is set to +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout + +\change_inserted -712698321 1723525171 +1 +\end_layout + +\end_inset + +, + a copy of the co-text (either selected text or the word preceding the cursor) is inserted as content on inset creation. +\change_unchanged + \end_layout \begin_layout Description @@ -22787,6 +22871,8 @@ status collapsed \change_inserted -712698321 1723455760 EscapeChars +\change_unchanged + \end_layout \end_inset @@ -22799,6 +22885,8 @@ status collapsed \change_inserted -712698321 1723455760 string +\change_unchanged + \end_layout \end_inset @@ -22817,6 +22905,8 @@ status collapsed \change_inserted -712698321 1723455760 %!@ +\change_unchanged + \end_layout \end_inset @@ -22829,6 +22919,8 @@ status collapsed \change_inserted -712698321 1723455760 ! +\change_unchanged + \end_layout \end_inset @@ -22841,6 +22933,8 @@ status collapsed \change_inserted -712698321 1723455760 @ +\change_unchanged + \end_layout \end_inset @@ -22853,6 +22947,8 @@ status collapsed \change_inserted -712698321 1723455760 % +\change_unchanged + \end_layout \end_inset diff --git a/lib/doc/de/Customization.lyx b/lib/doc/de/Customization.lyx index 7932ef56bf..b89a461d6c 100644 --- a/lib/doc/de/Customization.lyx +++ b/lib/doc/de/Customization.lyx @@ -19026,6 +19026,56 @@ nolink "false" \begin_inset Flex Code status collapsed +\begin_layout Plain Layout +InsertCotext +\end_layout + +\end_inset + + [ +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout + +\emph on +0 +\end_layout + +\end_inset + +, +\begin_inset space \thinspace{} +\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, + wird eine Kopie des umgebenden Texts (entweder der ausgewählte Text oder das Wort vor dem Cursor) bei der Erstellung als Inhalt eingefügt. +\end_layout + +\begin_layout Description +\begin_inset Flex Code +status collapsed + \begin_layout Plain Layout InToc \end_layout diff --git a/lib/layouts/stdinsets.inc b/lib/layouts/stdinsets.inc index 8dab576d3d..ea2a3cc50e 100644 --- a/lib/layouts/stdinsets.inc +++ b/lib/layouts/stdinsets.inc @@ -421,6 +421,7 @@ InsetLayout Index ForcePlain true ContentAsLabel true EscapeChars \"@|! + InsertCotext 1 End InsetLayout IndexMacro:see @@ -482,6 +483,7 @@ InsetLayout Nomenclature EscapeChars %!@| EndArgument EscapeChars %!@| + InsertCotext 1 End InsetLayout Box diff --git a/lib/scripts/layout2layout.py b/lib/scripts/layout2layout.py index b90350e109..cc3adaaa03 100644 --- a/lib/scripts/layout2layout.py +++ b/lib/scripts/layout2layout.py @@ -356,7 +356,8 @@ currentFormat = 107 # New CiteEngine type "notes" # Incremented to format 107, 12 August 2023 by spitz -# New InsetLayout and Layout tags "EscapeChars" +# New InsetLayout, Argument and Layout tags "EscapeChars" +# New InsetLayout tag "InsertCotext" # Do not forget to document format change in Customization # Manual (section "Declaring a new text class"). diff --git a/src/Text.cpp b/src/Text.cpp index 3a137202cf..7c0b18cbfd 100644 --- a/src/Text.cpp +++ b/src/Text.cpp @@ -3643,8 +3643,7 @@ bool doInsertInset(Cursor & cur, Text * text, bool gotsel = false; bool move_layout = false; - bool const copy_cotext = cmd.action() == LFUN_INDEX_INSERT - || cmd.action() == LFUN_NOMENCL_INSERT; + bool const copy_cotext = inset->getLayout().insertCotext(); if (cur.selection()) { if (copy_cotext) copySelectionToTemp(cur); diff --git a/src/TextClass.cpp b/src/TextClass.cpp index 8600b64d66..d58bc28d55 100644 --- a/src/TextClass.cpp +++ b/src/TextClass.cpp @@ -59,7 +59,7 @@ namespace lyx { // You should also run the development/tools/updatelayouts.py script, // to update the format of all of our layout files. // -int const LAYOUT_FORMAT = 107; // spitz: EscapeChars +int const LAYOUT_FORMAT = 107; // spitz: EscapeChars and InsertCotext // Layout format for the current lyx file format. Controls which format is diff --git a/src/insets/InsetLayout.cpp b/src/insets/InsetLayout.cpp index 581c01c569..4b0ef41ae0 100644 --- a/src/insets/InsetLayout.cpp +++ b/src/insets/InsetLayout.cpp @@ -125,6 +125,7 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass, IL_DOCBOOKRENDERASIMAGE, IL_ESCAPE_CHARS, IL_INHERITFONT, + IL_INSERTCOTEXT, IL_INTOC, IL_ISTOCCAPTION, IL_LABELFONT, @@ -217,6 +218,7 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass, { "htmlstyle", IL_HTMLSTYLE }, { "htmltag", IL_HTMLTAG }, { "inheritfont", IL_INHERITFONT }, + { "insertcotext", IL_INSERTCOTEXT }, { "intoc", IL_INTOC }, { "istoccaption", IL_ISTOCCAPTION }, { "keepempty", IL_KEEPEMPTY }, @@ -362,6 +364,9 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass, case IL_INHERITFONT: lex >> inheritfont_; break; + case IL_INSERTCOTEXT: + lex >> insert_cotext_; + break; case IL_INTOC: lex >> intoc_; break; diff --git a/src/insets/InsetLayout.h b/src/insets/InsetLayout.h index be9aabfafe..21f5095d1a 100644 --- a/src/insets/InsetLayout.h +++ b/src/insets/InsetLayout.h @@ -271,6 +271,8 @@ public: int allowedOccurrences() const { return allowed_occurrences_; } /// bool allowedOccurrencesPerItem() const { return allowed_occurrences_per_item_; } + /// + bool insertCotext() const { return insert_cotext_; } private: /// void makeDefaultCSS() const; @@ -468,6 +470,8 @@ private: int allowed_occurrences_ = -1; /// bool allowed_occurrences_per_item_ = false; + /// + bool insert_cotext_ = false; }; ///