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()).
This commit is contained in:
Jean-Marc Lasgouttes 2017-04-18 18:06:35 +02:00
parent b250eb5a46
commit e7c3354a87
2 changed files with 9 additions and 3 deletions

View File

@ -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;

View File

@ -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;