if (!bv->mouseSetCursor(cur, cmd.modifier() == ShiftModifier))
cur.screenUpdateFlags(Update::SinglePar | Update::FitCursor);
// FIXME: move this to mouseSetCursor?
- if (bvcur.wordSelection() && bvcur.inTexted()) {
- // select word around new position
- Cursor c = bvcur;
- c.selection(false);
- c.text()->selectWord(c, WHOLE_WORD);
- // use the correct word boundary, depending on selection direction
- if (bvcur.top() > bvcur.normalAnchor())
- bvcur.pos() = c.selEnd().pos();
- else
- bvcur.pos() = c.selBegin().pos();
- }
+ if (bvcur.wordSelection() && bvcur.inTexted())
+ expandWordSel(bvcur);
break;
case mouse_button::button2:
// We continue with our existing selection or start a new one, so don't
// reset the anchor.
bvcur.setCursor(cur);
+ if (bvcur.wordSelection() && bvcur.inTexted())
+ expandWordSel(bvcur);
bvcur.selection(true);
bvcur.setCurrentFont();
if (cur.top() == old) {
case LFUN_FLEX_INSERT: {
code = FLEX_CODE;
string s = cmd.getArg(0);
- InsetLayout il =
- cur.buffer()->params().documentClass().insetLayout(from_utf8(s));
- if (il.lyxtype() != InsetLyXType::CHARSTYLE &&
- il.lyxtype() != InsetLyXType::CUSTOM &&
- il.lyxtype ()!= InsetLyXType::STANDARD)
+ if (!cur.buffer()->params().documentClass().hasInsetLayout(from_utf8(s)))
enable = false;
- break;
+ else {
+ InsetLayout il =
+ cur.buffer()->params().documentClass().insetLayout(from_utf8(s));
+ if (il.lyxtype() != InsetLyXType::CHARSTYLE &&
+ il.lyxtype() != InsetLyXType::CUSTOM &&
+ il.lyxtype ()!= InsetLyXType::STANDARD)
+ enable = false;
+ }
+ break;
}
case LFUN_BOX_INSERT:
code = BOX_CODE;
docstring const req_layout = ignoreautonests ? from_utf8(cmd.getArg(0)) : cmd.argument();
docstring const layout = resolveLayout(req_layout, cur);
- enable = !owner_->forcePlainLayout() && !layout.empty();
- status.setOnOff(!owner_->forcePlainLayout() && isAlreadyLayout(layout, cur));
+ // FIXME: make this work in multicell selection case
+ enable = !owner_->forcePlainLayout() && !layout.empty() && !cur.selIsMultiCell();
+ status.setOnOff(!owner_->forcePlainLayout() && !cur.selIsMultiCell()
+ && isAlreadyLayout(layout, cur));
break;
}