X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FLength.cpp;h=10cdd2972615768ec518ef688adf2cd20ad1ac8b;hb=4db3e641ed6765e005343010cb90ee8af26f8f99;hp=f8eb920c0ff48e5b58bd0065d0aad38d00c9009a;hpb=5014b38cb7ca1967275050a90fcfe1aeade963e4;p=lyx.git diff --git a/src/Length.cpp b/src/Length.cpp index f8eb920c0f..10cdd29726 100644 --- a/src/Length.cpp +++ b/src/Length.cpp @@ -67,7 +67,8 @@ void Length::swap(Length & rhs) string const Length::asString() const { ostringstream os; - os << val_ << unit_name[unit_]; // setw? + if (unit_ != UNIT_NONE) + os << val_ << unit_name[unit_]; // setw? return os.str(); } @@ -75,7 +76,8 @@ string const Length::asString() const docstring const Length::asDocstring() const { odocstringstream os; - os << val_ << unit_name[unit_]; // setw? + if (unit_ != UNIT_NONE) + os << val_ << unit_name[unit_]; // setw? return os.str(); } @@ -102,6 +104,8 @@ string const Length::asLatexString() const case PPH: os << val_ / 100.0 << "\\paperheight"; break; + case UNIT_NONE: + break; default: os << val_ << unit_name[unit_]; break; @@ -363,6 +367,9 @@ GlueLength::GlueLength(string const & data) string const GlueLength::asString() const { + if (len_.empty()) + return string(); + ostringstream buffer; buffer << len_.value();