if (status() == Open) {
InsetText::metrics(mi, textdim_);
// This expression should not contain mi.base.texwidth
- openinlined_ = textdim_.wid < 0.5 * mi.base.bv->workWidth();
+ openinlined_ = !hasFixedWidth()
+ && textdim_.wid < 0.5 * mi.base.bv->workWidth();
if (openinlined_) {
// Correct for button width, and re-fit
mi.base.textwidth -= dim.wid;
switch (cmd.action) {
case LFUN_MOUSE_PRESS:
if (cmd.button() == mouse_button::button1 && hitButton(cmd)) {
+ // reset selection if necessary (see bug 3060)
+ if (cur.selection())
+ cur.bv().cursor().clearSelection();
+ else
+ cur.noUpdate();
cur.dispatched();
- cur.noUpdate();
break;
}
if (status() == Inlined)
break;
}
- if (cmd.button() == mouse_button::button1 && hitButton(cmd)
- && !cur.selection()) {
+ if (cmd.button() == mouse_button::button1 && hitButton(cmd)) {
+ // if we are selecting, we do not want to
+ // toggle the inset.
+ if (cur.selection())
+ break;
// Left button is clicked, the user asks to
// toggle the inset visual state.
cur.dispatched();
}
// The mouse click is within the opened inset.
- InsetText::doDispatch(cur, cmd);
+ if (status() == Open)
+ InsetText::doDispatch(cur, cmd);
break;
case LFUN_INSET_TOGGLE: