pit_type pit = cur.pit();
pos_type pos = cur.pos();
InsetText * target_inset = cur.inset().asInsetText();
+ if (!target_inset) {
+ InsetTabular * it = cur.inset().asInsetTabular();
+ target_inset = it? it->cell(cur.idx())->asInsetText() : 0;
+ }
LASSERT(target_inset, return make_pair(PitPosPair(pit, pos), pit));
ParagraphList & pars = target_inset->paragraphs();
// Convert newline to paragraph break in ERT inset.
// This should not be here!
- Inset * inset = pars[pit].inInset();
- if (inset && (inset->lyxCode() == ERT_CODE ||
- inset->lyxCode() == LISTINGS_CODE)) {
+ InsetCode const code = target_inset->lyxCode();
+ if (code == ERT_CODE || code == LISTINGS_CODE) {
for (size_t i = 0; i != insertion.size(); ++i) {
for (pos_type j = 0; j != insertion[i].size(); ++j) {
if (insertion[i].isNewline(j)) {
// do not track deletion of newline
insertion[i].eraseChar(j, false);
+ insertion[i].setInsetOwner(target_inset);
breakParagraphConservative(
buffer.params(),
insertion, i, j);
for (pos_type i = 0; i < tmpbuf->size(); ++i) {
// do not track deletion of invalid insets
if (Inset * inset = tmpbuf->getInset(i))
- if (target_inset->insetAllowed(inset->lyxCode()))
+ if (!target_inset->insetAllowed(inset->lyxCode()))
tmpbuf->eraseChar(i--, false);
}
docstring selection(size_t sel_index)
{
return sel_index < theCuts.size()
- ? theCuts[sel_index].first.back().asString(AS_STR_INSETS)
+ ? theCuts[sel_index].first.back().asString(AS_STR_INSETS | AS_STR_NEWLINES)
: docstring();
}
cur.recordUndo();
DocIterator selbeg = cur.selectionBegin();
- // Get font setting before we cut
+ // Get font setting before we cut, we need a copy here, not a bare reference.
Font const font =
selbeg.paragraph().getFontSettings(cur.buffer().params(), selbeg.pos());
if (lyxrc.auto_region_delete)
selDel(cur);
else
- cur.selection() = false;
+ cur.setSelection(false);
}