]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathKern.cpp
Fix bug #6246: InsetMathKern is broken
[lyx.git] / src / mathed / InsetMathKern.cpp
index 62ca0acff79cd8d086e1d00aa09b33a4ced136e4..7f990f996842ff99068b19794feb5d72186a6695 100644 (file)
@@ -3,7 +3,7 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author André Pönitz
+ * \author André Pönitz
  *
  * Full author contact details are available in file CREDITS.
  */
@@ -16,6 +16,7 @@
 #include "MathSupport.h"
 #include "Dimension.h"
 
+#include "support/docstring.h"
 
 namespace lyx {
 
@@ -56,13 +57,19 @@ void InsetMathKern::draw(PainterInfo &, int, int) const
 
 void InsetMathKern::write(WriteStream & os) const
 {
-       os << "\\kern" << from_utf8(wid_.asLatexString()) << ' ';
+       if (wid_.empty())
+               os << "\\kern" << ' ';
+       else
+               os << "\\kern" << from_utf8(wid_.asLatexString()) << ' ';
 }
 
 
 void InsetMathKern::normalize(NormalStream & os) const
 {
-       os << "[kern " << from_utf8(wid_.asLatexString()) << ']';
+       if (wid_.empty())
+               os << "[kern]";
+       else
+               os << "[kern " << from_utf8(wid_.asLatexString()) << ']';
 }