X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2FInsetVSpace.cpp;h=f621172fe2b5ba28475212002d26c7250fbdf6c7;hb=fd5d47d182a70de532225715a04b77fe4155aa18;hp=057435eedaf437e77395bedf8c182443553b4fbb;hpb=d866717ef7503a1373dd1cb3925e1ac97b079192;p=lyx.git diff --git a/src/insets/InsetVSpace.cpp b/src/insets/InsetVSpace.cpp index 057435eeda..f621172fe2 100644 --- a/src/insets/InsetVSpace.cpp +++ b/src/insets/InsetVSpace.cpp @@ -59,7 +59,12 @@ void InsetVSpace::doDispatch(Cursor & cur, FuncRequest & cmd) case LFUN_INSET_MODIFY: { cur.recordUndo(); - InsetVSpace::string2params(to_utf8(cmd.argument()), space_); + string arg = to_utf8(cmd.argument()); + if (arg == "vspace custom") + arg = (space_.kind() == VSpace::LENGTH) + ? "vspace " + space_.length().asString() + : "vspace 1" + string(stringFromUnit(Length::defaultUnit())); + InsetVSpace::string2params(arg, space_); break; } @@ -78,7 +83,12 @@ bool InsetVSpace::getStatus(Cursor & cur, FuncRequest const & cmd, case LFUN_INSET_MODIFY: if (cmd.getArg(0) == "vspace") { VSpace vspace; - InsetVSpace::string2params(to_utf8(cmd.argument()), vspace); + string arg = to_utf8(cmd.argument()); + if (arg == "vspace custom") + arg = (space_.kind() == VSpace::LENGTH) + ? "vspace " + space_.length().asString() + : "vspace 1" + string(stringFromUnit(Length::defaultUnit())); + InsetVSpace::string2params(arg, vspace); status.setOnOff(vspace == space_); } status.setEnabled(true); @@ -92,7 +102,7 @@ bool InsetVSpace::getStatus(Cursor & cur, FuncRequest const & cmd, void InsetVSpace::read(Lexer & lex) { - LASSERT(lex.isOK(), /**/); + LASSERT(lex.isOK(), return); string vsp; lex >> vsp; if (lex) @@ -207,7 +217,8 @@ void InsetVSpace::latex(otexstream & os, OutputParams const &) const } -int InsetVSpace::plaintext(odocstream & os, OutputParams const &) const +int InsetVSpace::plaintext(odocstringstream & os, + OutputParams const &, size_t) const { os << "\n\n"; return PLAINTEXT_NEWLINE; @@ -232,9 +243,9 @@ docstring InsetVSpace::xhtml(XHTMLStream &, OutputParams const &) const } -docstring InsetVSpace::contextMenuName() const +string InsetVSpace::contextMenuName() const { - return from_ascii("context-vspace"); + return "context-vspace"; }