commit b730a4b6a113a6d3d8a912eccf7e7826862aed76
Author: Juergen Spitzmueller <[email protected]>
Date: Sun Sep 13 10:19:25 2026 +0200
Provide direct way to insert inline and external file listing (#13364)
---
lib/RELEASE-NOTES | 3 +
lib/doc/EmbeddedObjects.lyx | 506 +++++++++++++++++++++++++++++++----------
lib/doc/de/EmbeddedObjects.lyx | 234 +++++++++++--------
lib/ui/stdmenus.inc | 8 +-
src/LyXAction.cpp | 3 +-
src/Text.cpp | 6 +
src/insets/InsetListings.h | 2 +
7 files changed, 544 insertions(+), 218 deletions(-)
diff --git a/lib/RELEASE-NOTES b/lib/RELEASE-NOTES
index 14b83d15f1..02e4006958 100644
--- a/lib/RELEASE-NOTES
+++ b/lib/RELEASE-NOTES
@@ -76,6 +76,9 @@
conversion with the first argument "latex" or "html" even if the pasted
string
comes from the internal clipboard.
+- The function listing-insert now has an optional argument "inline" which
allows
+ to insert a program listing in inline mode.
+
!!!The following LyX functions have been removed in 2.6:
- keymap-primary, keymap-secondary and keymap-toggle have been removed
diff --git a/lib/doc/EmbeddedObjects.lyx b/lib/doc/EmbeddedObjects.lyx
index fe0d8c8b9b..d92c41a0b4 100644
--- a/lib/doc/EmbeddedObjects.lyx
+++ b/lib/doc/EmbeddedObjects.lyx
@@ -42440,7 +42440,11 @@ Listings
\end_layout
\begin_layout Standard
-To include and typeset program code you can use the
+To
+\change_deleted -712698321 1789283952
+include and
+\change_unchanged
+typeset program code you can use the
\family sans
Listings
\family default
@@ -42505,7 +42509,21 @@ minted
\end_inset
- provide a powerful and flexible way to insert program source code into your
document.
+ provide a powerful and flexible way to
+\change_deleted -712698321 1789284058
+insert
+\change_inserted -712698321 1789284059
+display
+\change_unchanged
+
+\change_inserted -712698321 1789284035
+syntax-highlighted
+\change_unchanged
+program source code in
+\change_deleted -712698321 1789284062
+to
+\change_unchanged
+ your document.
One can only use one of these packages in a document.
\change_inserted -712698321 1784652862
@@ -42517,7 +42535,7 @@ listings
\series default
is used by default.
-\change_inserted -712698321 1784653642
+\change_inserted -712698321 1789284439
In order to use the more powerful package
\series bold
minted
@@ -42528,11 +42546,17 @@ minted
Listings
\family default
.
- Note that
+ As opposed to
+\series bold
+listings
+\series default
+,
+
\series bold
minted
\series default
- additionally requires the
+ employs an external program for syntax highlighting,
+ the
\noun on
Python
\noun default
@@ -42540,135 +42564,55 @@ Python
\family sans
pygments
\family default
- which is used for highlighting.
+.
As of 2024,
-
+ a tailored variant of
\family sans
pygments
\family default
is included in \SpecialChar TeX
+Live,
+ so
+\series bold
+minted
+\series default
+ is ready to use out of the box if you are using a reasonably recent version
of \SpecialChar TeX
Live.
\change_unchanged
\end_layout
\begin_layout Standard
+
+\change_deleted -712698321 1789284461
\begin_inset Note Note
-status open
+status collapsed
\begin_layout Plain Layout
-\series bold
-Note:
-
-\series default
- \SpecialChar LyX
- does NOT want to encourage users to add the
-\family typewriter
--shell-escape
-\family default
- option to converter definitions.
- It works,
- but it is a huge security risk.
- There is an active discussion about how to handle this.
- Once that's been resolved,
- this can be updated appropriately.
-\end_layout
-
-\begin_layout Plain Layout
-=====
\end_layout
\begin_layout Plain Layout
-
-\change_deleted -712698321 1784652827
-In order to use
-\series bold
-minted
-\series default
-,
- you need to select it as the syntax highlighting package in the document
settings under
-\family sans
-Listings
-\family default
-.
-
-\series bold
-minted
-\series default
- requires also additionally the module
-\family sans
-pygments
-\family default
- of the software
-\noun on
-Python
-\noun default
-
-\begin_inset Foot
-status collapsed
-
-\begin_layout Plain Layout
-Under \SpecialChar LyX
- for Windows
-\family sans
-pygments
-\family default
- is already installed.
-\end_layout
-
-\end_inset
-
-
-\change_inserted -712698321 1784653377
-Note that with \SpecialChar TeX
+With \SpecialChar TeX
Live older than 2024 and with Mik\SpecialChar TeX
,
\series bold
minted
\series default
- only runs if you enable the insecure
-\change_deleted -712698321 1784653169
-and the option
-\change_unchanged
-
+ only runs if you enable the insecure
\family typewriter
-shell-escape
\family default
-
-\change_inserted -712698321 1784653178
-option
-\change_unchanged
-for the \SpecialChar LaTeX
+ option for the \SpecialChar LaTeX
processor.
-
-\change_inserted -712698321 1784653225
-Since this makes your system vulnerable,
+ Since this makes your system vulnerable,
we do not recommend using it.
-
-\change_unchanged
-If you
-\change_inserted -712698321 1784653289
-still want,
+ If you still want,
and are sure about what you are doing,
you need to change the converter settings.
-
-\change_deleted -712698321 1784653293
-want f
-\change_inserted -712698321 1784653293
-F
-\change_unchanged
-or example
-\change_inserted -712698321 1784653304
-,
- for
-\change_unchanged
-
-\change_deleted -712698321 1784653307
-view or export your document as
-\change_unchanged
-the format
+ For example,
+ for the format
\family sans
PDF
\begin_inset space ~
@@ -42678,19 +42622,10 @@ PDF
\family default
,
go to
-\change_deleted -712698321 1784653322
-the \SpecialChar LyX
- preferences and there to the section
-\change_inserted -712698321 1784653338
-
\family sans
Tools\SpecialChar menuseparator
Preferences\SpecialChar ldots
\SpecialChar menuseparator
-
-\change_deleted -712698321 1784653339
-
-\change_unchanged
File
\begin_inset space ~
\end_inset
@@ -42770,9 +42705,143 @@ PDF
(XeTeX)
\family default
.
-
-\change_inserted -712698321 1784653434
But note again that this is a security risk!
+\end_layout
+
+\end_inset
+
+
+\change_inserted -712698321 1789284461
+
+\end_layout
+
+\begin_layout Standard
+
+\change_inserted -712698321 1789284488
+\begin_inset Note Greyedout
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted -712698321 1789284597
+With \SpecialChar TeX
+Live older than 2024 and with Mik\SpecialChar TeX
+,
+
+\series bold
+minted
+\series default
+ only runs if you install
+\family sans
+pygments
+\family default
+ yourself and if you enable the insecure
+\family typewriter
+-shell-escape
+\family default
+ option for the \SpecialChar LaTeX
+ processor.
+ Since this makes your system vulnerable,
+ we
+\series bold
+do not recommend
+\series default
+ using it!
+\end_layout
+
+\begin_layout Plain Layout
+
+\change_inserted -712698321 1789284805
+If you still want,
+ and are sure about what you are doing,
+ you need to change the converter settings.
+ For example,
+ for the format
+\family sans
+PDF
+\begin_inset space ~
+\end_inset
+
+(pdflatex)
+\family default
+,
+ go to
+\family sans
+Tools\SpecialChar menuseparator
+Preferences\SpecialChar ldots
+\SpecialChar menuseparator
+File
+\begin_inset space ~
+\end_inset
+
+Handling\SpecialChar menuseparator
+Converters
+\family default
+.
+ Navigate to the entry
+\family sans
+LaTeX
+\begin_inset space ~
+\end_inset
+
+(pdflatex) -> PDF
+\begin_inset space ~
+\end_inset
+
+(pdflatex)
+\family default
+ and observe the field
+\family sans
+Converter
+\family default
+,
+ which holds by default
+\family typewriter
+pdflatex $$i
+\family default
+.
+ Change this to
+\family typewriter
+pdflatex $$i -shell-escape
+\family default
+,
+
+\series bold
+
+\series default
+hit the
+\family sans
+Modify
+\family default
+ button and subsequently
+\family sans
+Apply
+\family default
+ or
+\family sans
+Save
+\family default
+.
+ The same can be done for the output formats
+\family sans
+PDF
+\begin_inset space ~
+\end_inset
+
+(LuaTeX)
+\family default
+ and
+\family sans
+PDF
+\begin_inset space ~
+\end_inset
+
+(XeTeX)
+\family default
+.
+ But note again that this is a
+\series bold
+security risk!
\change_unchanged
\end_layout
@@ -42780,6 +42849,8 @@ PDF
\end_inset
+\change_unchanged
+
\end_layout
\begin_layout Standard
@@ -42787,17 +42858,60 @@ Right-clicking on a listings inset opens the context
menu containing where you c
\end_layout
\begin_layout Standard
-By default,
+
+\change_deleted -712698321 1789280002
+By default
+\change_inserted -712698321 1789280019
+With
+\family sans
+Insert\SpecialChar menuseparator
+Program Listing\SpecialChar menuseparator
+Displayed
+\change_unchanged
+
+\family default
+,
a listing starts a new paragraph in the output.
- The placement option
+
+\change_inserted -712698321 1789280057
+ With
+\family sans
+Insert\SpecialChar menuseparator
+Program Listing\SpecialChar menuseparator
+Inline
+\change_unchanged
+
+\family default
+
+\change_inserted -712698321 1789280051
+or
+\change_deleted -712698321 1789280049
+T
+\change_inserted -712698321 1789280051
+t
+\change_unchanged
+he placement option
\family sans
Inline
\begin_inset space ~
\end_inset
listing
+\change_inserted -712698321 1789280068
+,
+
+\change_unchanged
+
\family default
- prints the listing inline like this:
+
+\change_deleted -712698321 1789280072
+prints
+\change_unchanged
+the listing
+\change_inserted -712698321 1789280079
+ is printed
+\change_unchanged
+ inline like this:
\begin_inset listings
lstparams "language={C++}"
@@ -42811,9 +42925,99 @@ int a=5;
\end_inset
+\change_deleted -712698321 1789285134
+
\begin_inset Newline newline
\end_inset
+
+\change_inserted -712698321 1789285136
+.
+\end_layout
+
+\begin_layout Standard
+
+\change_inserted -712698321 1789286380
+With
+\series bold
+listings
+\series default
+,
+ the program listings by default inherit the font which is used in the
listing's surrounding (usually a serif font,
+ as you can see when checking the PDF output of the current manual).
+ Displayed listings by default try to emulate some kind of mono-space
typesetting,
+ which looks rather awkward but ensures consecutive code lines are aligned
properly (you can disable this with the setting
+\family typewriter
+columns=fullflexible
+\family default
+).
+ If you want to use a monospaced (a.
+\begin_inset space \thinspace{}
+\end_inset
+
+k.
+\begin_inset space \thinspace{}
+\end_inset
+
+a.
+ typewriter) font instead,
+ following the widespread convention of code typesetting (which
+\series bold
+minted
+\series default
+ employs by default),
+ you can either set the font for individual listings in their
+\family sans
+Settings
+\family default
+ dialog,
+ or globally via
+\family sans
+Document\SpecialChar menuseparator
+Settings\SpecialChar menuseparator
+Listings
+\family default
+ (where all
+\change_deleted -712698321 1789285795
+
+\end_layout
+
+\begin_layout Standard
+
+\change_inserted -712698321 1789286108
+global listings settings can be done).
+ The document settings does not provide a nifty GUI for the most important
settings as the Listings Settings do.
+ Rather than that,
+ you need to insert listings options directly.
+ In the case of changing font to monospaced,
+ this would be
+\family typewriter
+basicstyle=
+\backslash
+ttfamily
+\family default
+.
+ The options are documented in the listings manual
+\begin_inset CommandInset citation
+LatexCommand cite
+key "listings"
+literal "false"
+
+\end_inset
+
+;
+ if you type a question mark
+\family typewriter
+?
+
+\family default
+ in the options widget,
+ you will also be provided with a list of available options.
+\change_unchanged
+
+\end_layout
+
+\begin_layout Standard
The option
\family sans
Float
@@ -43347,7 +43551,23 @@ listings
\begin_layout Standard
It is also possible to print lines from a file as listing.
To do this,
- use the menu
+ use
+\change_inserted -712698321 1789281821
+
+\family sans
+Insert\SpecialChar menuseparator
+Program Listing\SpecialChar menuseparator
+External
+\begin_inset space ~
+\end_inset
+
+File
+\family default
+ (or,
+ alternatively,
+
+\change_unchanged
+the menu
\family sans
Insert\SpecialChar menuseparator
File\SpecialChar menuseparator
@@ -43356,8 +43576,12 @@ Child Document
and choose the type
\family sans
Listings
+\change_deleted -712698321 1789280361
+
\family default
.
+\change_unchanged
+
\begin_inset Foot
status collapsed
@@ -43379,7 +43603,21 @@ nolink "false"
\end_inset
- In the child document dialog you can specify the listing parameters in a text
box.
+
+\change_inserted -712698321 1789280363
+),
+
+\change_unchanged
+ In the
+\change_deleted -712698321 1789280386
+child document
+\change_unchanged
+ dialog
+\change_inserted -712698321 1789280392
+ that opens,
+
+\change_unchanged
+ you can specify the listing parameters in a text box.
To show a list of all available parameters,
type in a question mark
\begin_inset Quotes eld
@@ -43393,8 +43631,18 @@ nolink "false"
\end_layout
\begin_layout Standard
-To reference child document listings,
- write a label text into the corresponding field of the child document dialog.
+To reference
+\change_deleted -712698321 1789280402
+child document
+\change_inserted -712698321 1789281836
+external file
+\change_unchanged
+ listings,
+ write a label text into the corresponding field of the
+\change_deleted -712698321 1789280413
+child document
+\change_unchanged
+dialog.
The label can then be referenced using the menu
\family sans
Insert\SpecialChar menuseparator
@@ -43416,8 +43664,16 @@ nolink "false"
\end_inset
- is an example for a listing of a file;
- there the lines 10
+ is an example for a
+\change_inserted -712698321 1789281712
+n external
+\change_unchanged
+ listing of a file;
+
+\change_deleted -712698321 1789281721
+there
+\change_unchanged
+the lines 10
\begin_inset space \thinspace{}
\end_inset
@@ -43559,6 +43815,8 @@ frac{1}{x^{2}}$
\end_layout
\begin_layout Standard
+
+\change_deleted -712698321 1789285752
Global listings settings can be set in the
\family sans
Document\SpecialChar menuseparator
@@ -43576,6 +43834,8 @@ Listings
\end_inset
.
+\change_unchanged
+
\end_layout
\begin_layout Standard
diff --git a/lib/doc/de/EmbeddedObjects.lyx b/lib/doc/de/EmbeddedObjects.lyx
index 1f9d78078c..d10f648928 100644
--- a/lib/doc/de/EmbeddedObjects.lyx
+++ b/lib/doc/de/EmbeddedObjects.lyx
@@ -42937,7 +42937,7 @@ Programm-Code
\end_layout
\begin_layout Standard
-Um Programm-Code-Listen einzufügen und zu drucken,
+Um Programm-Code-Listen darzustellen,
können Sie
\family sans
Einfügen\SpecialChar menuseparator
@@ -42945,7 +42945,7 @@ Pro\SpecialChar softhyphen
grammlisting
\family default
verwenden.
- Die \SpecialChar LaTeX
+ Mithilfe der \SpecialChar LaTeX
-Pakete
\series bold
listings
@@ -43000,7 +43000,7 @@ minted
\end_inset
- können Programm-Code auf vielfältige und flexible Weise in Ihr Dokument
einfügen.
+ können Sie Programm-Code mit Syntax-Hervorhebung auf vielfältige und flexible
Weise in Ihrem Dokument darstellen.
Man kann nur eines der Pakete in einem Dokument verwenden.
Das Paket
\series bold
@@ -43017,51 +43017,36 @@ minted
Programmlistings
\family default
festlegen.
- Beachten Sie aber,
- dass
+ Im Gegensatz zu
+\series bold
+listings
+\series default
+ verwendet
\series bold
minted
\series default
- für die Code-Hervorhebung zusätzlich die Python-Bibliothek
+ für die Code-Hervorhebung ein externes Programm,
+ die Python-Bibliothek
\family sans
pygments
\family default
- benötigt,
- die aber ab der Version 2024 in \SpecialChar TeX
-Live enthalten ist.
-\end_layout
-
-\begin_layout Standard
-\begin_inset Note Note
-status open
-
-\begin_layout Plain Layout
-
+.
+ Dieses ist aber in einer angepassten Variante ab der Version 2024 in
\SpecialChar TeX
+Live enthalten so dass
\series bold
-Achtung:
-
+minted
\series default
- Es wird nicht empfohlen die Option
-\family typewriter
--shell-escape
-\family default
- zu verwenden.
- Sie funktioniert,
- ist aber ein großes Sicherheitsproblem.
- Die \SpecialChar LyX
--Entwickler diskutieren,
- wie damit umzugehen ist.
- Diese Notiz kann erst geändert werden,
- bis eine Entscheidung getroffen wurde.
+ direkt verwendet werden kann,
+ wenn Sie eine hinreichend neue Version von \SpecialChar TeX
+Live verwenden.
\end_layout
-\begin_layout Plain Layout
-=====
-\end_layout
+\begin_layout Standard
+\begin_inset Note Greyedout
+status collapsed
\begin_layout Plain Layout
-Beachten Sie:
- In \SpecialChar TeX
+In \SpecialChar TeX
Live-Distributionen vor 2024 und bei Mik\SpecialChar TeX
läuft
\series bold
@@ -43075,8 +43060,13 @@ minted
für den \SpecialChar LaTeX
-Prozessor aktiviert ist.
Da dies ihr System angreifbarer macht,
- raten wir nachdrücklich davon ab.
- Wenn Sie es trotzdem verwenden wollen (und wirklich wissen,
+
+\series bold
+raten wir nachdrücklich davon ab!
+\end_layout
+
+\begin_layout Plain Layout
+Wenn Sie es trotzdem verwenden wollen (und wirklich wissen,
was Sie tun!),
müssen Sie die Konvertereinstellungen ändern.
Für das Format
@@ -43094,7 +43084,7 @@ Datei-Handhanbung\SpecialChar menuseparator
Konverter
\family default
.
- gehen Sie dort auf den Eintrag
+ Gehen Sie dort auf den Eintrag
\family sans
LaTeX
\begin_inset space ~
@@ -43111,35 +43101,24 @@ LaTeX
Konverter
\family default
.
- Dort sehen sie den Inhalt
-\begin_inset Newline newline
-\end_inset
-
-
-\series bold
+ Standardmäßig ist dort eingestellt:
+
+\family typewriter
pdflatex $$i
-\series default
-
-\begin_inset Newline newline
-\end_inset
-
-Ändern Sie ihn nun ab zu
-\begin_inset Newline newline
-\end_inset
-
-
-\series bold
+\family default
+.
+ Ändern Sie dies zu
+\family typewriter
pdflatex $$i -shell-escape
-\begin_inset Newline newline
-\end_inset
-
-
+\family default
+\series bold
+
\series default
-und drücken Sie den
+und drücken Sie
\family sans
Ändern
\family default
--Knopf und anschließend
+ und anschließend
\family sans
Übernehmen
\family default
@@ -43166,7 +43145,9 @@ PDF
\family default
gemacht werden.
Nochmals aber:
- Das ist ein Sicherheitsrisiko!
+ Das ist ein
+\series bold
+Sicherheitsrisiko!
\end_layout
\end_inset
@@ -43180,8 +43161,21 @@ Ein Rechtsklick auf ein Listing öffnet das Kontextmenü,
\end_layout
\begin_layout Standard
-Standardmäßig fängt ein Listing mit einem neuen Absatz an.
- Die Platzierungsoption
+Wenn Sie
+\family sans
+Einfügen\SpecialChar menuseparator
+Programmlisting\SpecialChar menuseparator
+Abgesetzt
+\family default
+ verwenden,
+ fängt ein Listing mit einem neuen Absatz an.
+ Mit
+\family sans
+Einfügen\SpecialChar menuseparator
+Programmlisting\SpecialChar menuseparator
+Eingebettet
+\family default
+ oder der Platzierungsoption
\family sans
Eingebettetes
\begin_inset space ~
@@ -43203,9 +43197,72 @@ int a=5;
\end_inset
-\begin_inset Newline newline
+\end_layout
+
+\begin_layout Standard
+Mit
+\series bold
+listings
+\series default
+ übernehmen die Listings per Voreinstellung die Schriftart,
+ die in der Umgebung des Listings verwendet wird (üblicherweise eine
Serifenschrift,
+ wie Sie auch am vorliegenden Handbuch sehen können,
+ wenn Sie die PDF-Ausgabe betrachten).
+ Abgesetzte Listings versuchen per Voreinstellung zusätzlich,
+ eine Art von dicktengleichem Satz zu emulieren,
+ was nicht gut aussieht aber versichert,
+ dass aufeinander folgende Code-Zeilen sinnvoll ausgerichtet sind (Sie können
dieses Verhalten über die Einstellung
+\family typewriter
+columns=fullflexible
+\family default
+ abstellen).
+ Falls Sie statt dessen eine dicktengleiche Schrift (also Schreibmaschine)
verwenden wollen,
+ wie es in der Darstellung von Code üblich ist,
+ können Sie entweder die Schrift für einzelne Listings in deren
+\family sans
+Einstellungen
+\family default
+ anpassen oder dies global für alle über
+\family sans
+Dokument\SpecialChar menuseparator
+Einstellungen\SpecialChar menuseparator
+Programmlistings
+\family default
+ (wo alle globalen Listings-Einstellungen gemacht werden) tun.
+ Die Dokument-Einstellungen für Listings bieten im Gegensatz zu den
Listings-Einstellungen keine elegante GUI für die wichtigsten Einstellungen.
+ Vielmehr müssen Sie direkt Listings-Optionen eingeben.
+ Im Fall,
+ dass Sie dicktengleiche Schrift wünschen,
+ wäre dies
+\family typewriter
+basicstyle=
+\backslash
+ttfamily
+\family default
+.
+ Die Optionen sind im Handbuch des Pakets
+\series bold
+listings
+\series default
+
+\begin_inset CommandInset citation
+LatexCommand cite
+key "listings"
+literal "false"
+
\end_inset
+ dokumentiert;
+ wenn Sie im Optionen-Feld ein Fragezeichen
+\family typewriter
+?
+
+\family default
+ eingeben,
+ wird Ihnen aber auch eine Liste mit möglichen Optionen angezeigt.
+\end_layout
+
+\begin_layout Standard
Die Option
\family sans
Gleitobjekt
@@ -43713,7 +43770,17 @@ listings
\noindent
Es ist auch möglich,
Zeilen einer Datei als Listing zu drucken.
- Das machen Sie mit
+ Das machen Sie mit
+\family sans
+Einfügen\SpecialChar menuseparator
+Programmlisting\SpecialChar menuseparator
+Externe
+\begin_inset space ~
+\end_inset
+
+Datei
+\family default
+ (oder alternativ
\family sans
Einfügen\SpecialChar menuseparator
Datei\SpecialChar menuseparator
@@ -43735,7 +43802,7 @@ Einbindung
\family sans
Listing
\family default
-.
+
\begin_inset Foot
status collapsed
@@ -43757,11 +43824,12 @@ nolink "false"
\end_inset
- Im Dialogfenster
+).
+ Im erscheinenden Dialogfenster
\family sans
- Unterdokument
+
\family default
- können Sie die Listing-Parameter unter
+können Sie die Listing-Parameter unter
\family sans
Weitere
\begin_inset space ~
@@ -43783,7 +43851,7 @@ Parameter
\end_layout
\begin_layout Standard
-Um auf ein Unterdokument-Listing verweisen zu können,
+Um auf ein externes Datei-Listing verweisen zu können,
schreiben Sie einen Text ins Feld
\family sans
Marke
@@ -43805,7 +43873,7 @@ nolink "false"
\end_inset
- ist ein Beispiel für ein Unterdokument-Listing,
+ ist ein Beispiel für ein externes Listing einer Datei,
bei dem die Zeilen 10
\begin_inset space \thinspace{}
\end_inset
@@ -43942,26 +44010,6 @@ frac{1}{x^{2}}$
\end_layout
-\begin_layout Standard
-\noindent
-Dokumentweite Listing-Eigenschaften können im Dialog
-\family sans
-Dokument\SpecialChar menuseparator
-Einstellungen\SpecialChar menuseparator
-Listing
-\family default
- festgelegt werden.
- Dort bekommt man durch Eingabe eines Fragezeichens
-\begin_inset Quotes gld
-\end_inset
-
-?
-\begin_inset Quotes grd
-\end_inset
-
- eine Liste aller möglichen Parameter.
-\end_layout
-
\begin_layout Standard
Weitere Informationen über die Pakete
\series bold
diff --git a/lib/ui/stdmenus.inc b/lib/ui/stdmenus.inc
index 979e274bd5..4e26ee8a27 100644
--- a/lib/ui/stdmenus.inc
+++ b/lib/ui/stdmenus.inc
@@ -410,7 +410,7 @@ Menuset
Item "Hyperlink...|k" "href-insert"
Item "Footnote|F" "footnote-insert"
Item "Marginal Note|M" "marginalnote-insert"
- Item "Program Listing[[Menu]]" "listing-insert"
+ Submenu "Program Listing[[Menu]]" "insert_listings"
Separator
EnvironmentSeparators
Separator
@@ -565,6 +565,12 @@ Menuset
Custom
End
+ Menu "insert_listings"
+ Item "Displayed[[Listing]]|D" "listing-insert"
+ Item "Inline[[Listing]]|I" "listing-insert inline"
+ Item "External File[[Listing]]...|E" "dialog-show-new-inset
include lstinputlisting"
+ End
+
#
# DOCUMENT MENU
#
diff --git a/src/LyXAction.cpp b/src/LyXAction.cpp
index f5939d8f07..6d844da8e9 100644
--- a/src/LyXAction.cpp
+++ b/src/LyXAction.cpp
@@ -2641,7 +2641,8 @@ void LyXAction::init()
/*!
* \var lyx::FuncCode lyx::LFUN_LISTING_INSERT
* \li Action: Inserts a new listings inset.
- * \li Syntax: listing-insert
+ * \li Syntax: listing-insert [inline]
+ * \li Notion: With inline, an inline listing is inserted (default is
displayed).
* \li Origin: Herbert, 10 Nov 2001; bpeng, 2 May 2007
* \endvar
*/
diff --git a/src/Text.cpp b/src/Text.cpp
index 34237a482c..c34231b1aa 100644
--- a/src/Text.cpp
+++ b/src/Text.cpp
@@ -80,6 +80,7 @@
#include "insets/InsetGraphics.h"
#include "insets/InsetGraphicsParams.h"
#include "insets/InsetInfo.h"
+#include "insets/InsetListings.h"
#include "insets/InsetIPAMacro.h"
#include "insets/InsetNewline.h"
#include "insets/InsetQuotes.h"
@@ -3644,6 +3645,11 @@ bool doInsertInset(Cursor & cur, Text * text,
ia->init(cur.paragraph());
}
+ if (cmd.action() == LFUN_LISTING_INSERT && cmd.argument() == "inline") {
+ InsetListings * const ia = static_cast<InsetListings *>(inset);
+ ia->setInline(true);
+ }
+
if (edit)
inset->edit(cur, true);
diff --git a/src/insets/InsetListings.h b/src/insets/InsetListings.h
index 7ee662a1ec..9bfc751eec 100644
--- a/src/insets/InsetListings.h
+++ b/src/insets/InsetListings.h
@@ -46,6 +46,8 @@ public:
bool isEnvironment() const override { return !params().isInline(); }
///
bool needsCProtection(bool const, bool const) const override { return
!params().isInline(); }
+ ///
+ void setInline(bool const b) { params().setInline(b); }
private:
///
bool isLabeled() const override { return true; }
--
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs