X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2Finsetcollapsable.C;h=aec1bf69ec0fdc5901a2008e87fd99723f979d08;hb=e28331ed63062dea10d0a21b9ec12034b4b17b9a;hp=d1e6949a5c875b9c9e7c00c7042c9938cbd1f71c;hpb=af75e269c79d9905d0faa0c32b8fe4c0bfe1594b;p=lyx.git diff --git a/src/insets/insetcollapsable.C b/src/insets/insetcollapsable.C index d1e6949a5c..aec1bf69ec 100644 --- a/src/insets/insetcollapsable.C +++ b/src/insets/insetcollapsable.C @@ -161,7 +161,8 @@ bool InsetCollapsable::metrics(MetricsInfo & mi, Dimension & dim) const 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; @@ -305,7 +306,7 @@ void InsetCollapsable::edit(LCursor & cur, bool left) InsetBase * InsetCollapsable::editXY(LCursor & cur, int x, int y) { //lyxerr << "InsetCollapsable: edit xy" << endl; - if (status() == Collapsed || button_dim.contains(x, y)) + if (status() == Collapsed || (button_dim.contains(x, y) && status() != Inlined)) return this; cur.push(*this); return InsetText::editXY(cur, x, y); @@ -319,9 +320,13 @@ void InsetCollapsable::doDispatch(LCursor & cur, FuncRequest & cmd) switch (cmd.action) { case LFUN_MOUSE_PRESS: - if (cmd.button() == mouse_button::button1 && hitButton(cmd)) { + if (cmd.button() == mouse_button::button1 && hitButton(cmd) && status() != Inlined) { + // 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) @@ -357,8 +362,12 @@ void InsetCollapsable::doDispatch(LCursor & cur, FuncRequest & cmd) } if (cmd.button() == mouse_button::button1 && hitButton(cmd)) { - // Left button is clicked, the user asks to toggle the inset - // visual state. + // 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(); cur.updateFlags(Update::Force | Update::FitCursor); if (status() == Collapsed) { @@ -373,7 +382,8 @@ void InsetCollapsable::doDispatch(LCursor & cur, FuncRequest & cmd) } // The mouse click is within the opened inset. - InsetText::doDispatch(cur, cmd); + if (status() == Open) + InsetText::doDispatch(cur, cmd); break; case LFUN_INSET_TOGGLE: