From e7c3354a871f6f693948bf4c8381dd22ba3a0f13 Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Tue, 18 Apr 2017 18:06:35 +0200 Subject: [PATCH] Fixes to ParIndent support - remove quotes around length - use "default" for default parindent, instead of an empty string - Fix the constructor Length(string const &) so that an empty string corresponds to an empty length (coherent with Length::asString()). --- src/BufferParams.cpp | 10 ++++++++-- src/Length.cpp | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp index 09ec43467b..9f05fe8156 100644 --- a/src/BufferParams.cpp +++ b/src/BufferParams.cpp @@ -822,7 +822,12 @@ string BufferParams::readToken(Lexer & lex, string const & token, lex >> parsep; paragraph_separation = parseptranslator().find(parsep); } else if (token == "\\paragraph_indentation") { - lex >> pimpl_->parindent; + lex.next(); + string parindent = lex.getString(); + if (parindent == "default") + pimpl_->parindent = Length(); + else + pimpl_->parindent = Length(parindent); } else if (token == "\\defskip") { lex.next(); string const defskip = lex.getString(); @@ -1327,7 +1332,8 @@ void BufferParams::writeFile(ostream & os, Buffer const * buf) const << "\n\\paragraph_separation " << string_paragraph_separation[paragraph_separation]; if (!paragraph_separation) - os << "\n\\paragraph_indentation " << Lexer::quoteString(pimpl_->parindent.asString()); + os << "\n\\paragraph_indentation " + << (pimpl_->parindent.empty() ? "default" : pimpl_->parindent.asString()); else os << "\n\\defskip " << getDefSkip().asLyXCommand(); os << "\n\\is_math_indent " << is_math_indent; diff --git a/src/Length.cpp b/src/Length.cpp index 5c4dfc5ae1..bc8fb7ea55 100644 --- a/src/Length.cpp +++ b/src/Length.cpp @@ -52,7 +52,7 @@ Length::Length(double v, Length::UNIT u) Length::Length(string const & data) - : val_(0), unit_(Length::PT) + : val_(0), unit_(Length::UNIT_NONE) { Length tmp; -- 2.39.5