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);
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;
if (lex.checkFor("\\length"))
lex >> length;
- lex >> "\\end_inset";
}
void InsetSpace::write(ostream & os) const
{
- os << "Space ";
+ os << "space ";
params_.write(os);
}
void InsetSpace::read(Lexer & lex)
{
params_.read(lex);
+ lex >> "\\end_inset";
}
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);
}