Le 17/02/2016 19:10, Pavel Sanda a écrit :
Joel Kulesza wrote:
My suggestion is to change the default font of the Settings->Preamble text
box to a fixed-width font because the content is effectively code.  This
change should improve readability for those that make extensive use of the
preamble.

Going a step further with the topic: would it also make sense to disable
(or make optional) line-wrapping in the preamble dialog?

I would appreciate hearing your thoughts on this.

Seems like trivial and sensible fix, if anyone comes with patch it can make
it into 2.2.0/x.



The attached patch copies code from the source panel, so it is safe.


>From 3339ed951d8bec5ac1783182baca7d51f6516326 Mon Sep 17 00:00:00 2001
From: Guillaume Munch <g...@lyx.org>
Date: Wed, 17 Feb 2016 21:45:44 +0000
Subject: [PATCH] Set the preamble in fixed-width font and without line breaks
 (#9966)

---
 src/frontends/qt4/GuiDocument.cpp | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/frontends/qt4/GuiDocument.cpp b/src/frontends/qt4/GuiDocument.cpp
index cf64849..60aee1c 100644
--- a/src/frontends/qt4/GuiDocument.cpp
+++ b/src/frontends/qt4/GuiDocument.cpp
@@ -453,6 +453,11 @@ PreambleModule::PreambleModule() : current_id_(0)
 	// This is not a memory leak. The object will be destroyed
 	// with this.
 	(void) new LaTeXHighlighter(preambleTE->document());
+	QFont font(guiApp->typewriterFontName());
+	font.setFixedPitch(true);
+	font.setStyleHint(QFont::TypeWriter);
+	preambleTE->setFont(font);
+	preambleTE->setWordWrapMode(QTextOption::NoWrap);
 	setFocusProxy(preambleTE);
 	connect(preambleTE, SIGNAL(textChanged()), this, SIGNAL(changed()));
 }
-- 
2.1.4

Reply via email to