Dear all, InsetListings, like InsetInclude uses display() to aligh itself in the center. However, it is more natural to have them displayed (separate paragraph), but shift to the left.
Will the attached patch be acceptable? If people like it, I can set displayLeft to InsetInclude as well. Bo Index: src/insets/InsetListings.h =================================================================== --- src/insets/InsetListings.h (revision 18382) +++ src/insets/InsetListings.h (working copy) @@ -34,6 +34,8 @@ Inset::Code lyxCode() const { return Inset::LISTINGS_CODE; } /// lstinline is inlined, normal listing is displayed virtual bool display() const; + /// listings, if displayed, align to the left + virtual bool displayLeft() const { return true; } /// docstring name() const { return from_ascii("Listings"); } /// Index: src/insets/Inset.h =================================================================== --- src/insets/Inset.h (revision 18382) +++ src/insets/Inset.h (working copy) @@ -379,6 +379,8 @@ virtual bool isSpace() const { return false; } /// should we have a non-filled line before this inset? virtual bool display() const { return false; } + /// should this displayed inset align to the left? + virtual bool displayLeft() const { return false; } /// should we break lines after this inset? virtual bool isLineSeparator() const { return false; } /// should paragraph indendation be ommitted in any case? Index: src/TextMetrics.cpp =================================================================== --- src/TextMetrics.cpp (revision 18382) +++ src/TextMetrics.cpp (working copy) @@ -326,7 +326,10 @@ && par.isInset(row.pos()) && par.getInset(row.pos())->display()) { - align = LYX_ALIGN_CENTER; + if (par.getInset(row.pos())->displayLeft()) + align = LYX_ALIGN_BLOCK; + else + align = LYX_ALIGN_CENTER; } switch (align) {