X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2FInsetSpace.cpp;h=c9156d4e51136255c9ceabaac876277baf66806f;hb=4a1be58591ea5a7431d9426abb27d8b946c634cb;hp=a637bf4b3539398582d7158925d0950953011be6;hpb=2e60364941319e7a42314e36dd6e73eef4239dc3;p=lyx.git diff --git a/src/insets/InsetSpace.cpp b/src/insets/InsetSpace.cpp index a637bf4b35..c9156d4e51 100644 --- a/src/insets/InsetSpace.cpp +++ b/src/insets/InsetSpace.cpp @@ -158,9 +158,8 @@ bool InsetSpace::getStatus(Cursor & cur, FuncRequest const & cmd, InsetSpaceParams params; string2params(to_utf8(cmd.argument()), params); status.setOnOff(params_.kind == params.kind); - } else { - status.enabled(true); } + status.setEnabled(true); return true; default: return Inset::getStatus(cur, cmd, status); @@ -240,7 +239,18 @@ void InsetSpace::draw(PainterInfo & pi, int x, int y) const int const y0 = y + desc - 1; int const y1 = y - asc + oddheight - 1; int const y2 = (y0 + y1) / 2; - int const xoffset = (y0 - y1) / 2; + int xoffset = (y0 - y1) / 2; + + //Two tests for very narrow insets + if (xoffset > x1 - x0 + && (params_.kind == InsetSpaceParams::LEFTARROWFILL + || params_.kind == InsetSpaceParams::RIGHTARROWFILL)) + xoffset = x1 - x0; + if (xoffset * 6 > (x1 - x0) + && (params_.kind == InsetSpaceParams::UPBRACEFILL + || params_.kind == InsetSpaceParams::DOWNBRACEFILL)) + xoffset = (x1 - x0) / 6; + int const x2 = x0 + xoffset; int const x3 = x1 - xoffset; int const xm = (x0 + x1) / 2; @@ -431,13 +441,12 @@ void InsetSpaceParams::read(Lexer & lex) if (lex.checkFor("\\length")) lex >> length; - lex >> "\\end_inset"; } void InsetSpace::write(ostream & os) const { - os << "Space "; + os << "space "; params_.write(os); } @@ -445,6 +454,7 @@ void InsetSpace::write(ostream & os) const void InsetSpace::read(Lexer & lex) { params_.read(lex); + lex >> "\\end_inset"; } @@ -622,7 +632,11 @@ void InsetSpace::string2params(string const & in, InsetSpaceParams & params) lex.setContext("InsetSpace::string2params"); lex >> "space"; - params.read(lex); + // There are cases, such as when we are called via getStatus() from + // Dialog::canApply(), where we are just called with "space" rather + // than a full "space \type{}\n\\end_inset". + if (lex.isOK()) + params.read(lex); }