if (cur.selection())
cutSelection(cur, true, false);
cur.insert(inset);
+ cur.forceBufferUpdate();
if (inset->editable() && inset->asInsetText())
inset->edit(cur, true);
else
bool const outer = cmd.argument() == "outer";
bool const previous = cmd.argument() == "previous";
bool const before = cmd.argument() == "before";
+ bool const normal = cmd.argument().empty();
Paragraph const & para = cur.paragraph();
docstring layout;
if (para.layout().isEnvironment())
if (cpar.params().depth() == 0)
break;
}
- if (outer && pit < cur.lastpit()) {
- // save nesting of following paragraph
- cpar = pars_[cur.pit() + 1];
- nextpar_depth = cpar.params().depth();
- }
+ }
+ if ((outer || normal) && cur.pit() < cur.lastpit()) {
+ // save nesting of following paragraph
+ Paragraph cpar = pars_[cur.pit() + 1];
+ nextpar_depth = cpar.params().depth();
}
if (before)
cur.top().setPitPos(cur.pit(), 0);
else
lyx::dispatch(FuncRequest(LFUN_PARAGRAPH_BREAK, "inverse"));
lyx::dispatch(FuncRequest(LFUN_LAYOUT, layout));
- if (outer && nextpar_depth > 0) {
+ if ((outer || normal) && nextpar_depth > 0) {
// restore nesting of following paragraph
DocIterator scur = cur;
+ depth_type const max_depth = cur.paragraph().getMaxDepthAfter();
cur.forwardPar();
- while (cur.paragraph().params().depth() < nextpar_depth)
+ while (cur.paragraph().params().depth() <= min(nextpar_depth, max_depth))
lyx::dispatch(FuncRequest(LFUN_DEPTH_INCREMENT));
cur.setCursor(scur);
}
break;
cur.recordUndo();
insertInset(cur, inset);
+ cur.forceBufferUpdate();
cur.posForward();
break;
}
break;
}
else if (cur.paragraph().layout().isEnvironment()) {
- enable = true;
+ enable = cmd.argument() == "before"
+ || cur.pos() > 0 || !isFirstInSequence(cur.pit());
break;
}
enable = false;