Buffer const & buffer = cur.buffer();
pit_type pit = cur.pit();
pos_type pos = cur.pos();
Buffer const & buffer = cur.buffer();
pit_type pit = cur.pit();
pos_type pos = cur.pos();
- ParagraphList & pars = cur.text()->paragraphs();
+ InsetText * target_inset = cur.inset().asInsetText();
+ LASSERT(target_inset, return make_pair(PitPosPair(pit, pos), pit));
+ ParagraphList & pars = target_inset->paragraphs();
- 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);
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);
Layout const & defaultLayout = newDocClass->defaultLayout();
ParagraphList::iterator const end = insertion.end();
ParagraphList::iterator par = insertion.begin();
for (; par != end; ++par) {
Layout const & parLayout = par->layout();
if (forcePlainLayout || parLayout == defaultLayout)
Layout const & defaultLayout = newDocClass->defaultLayout();
ParagraphList::iterator const end = insertion.end();
ParagraphList::iterator par = insertion.begin();
for (; par != end; ++par) {
Layout const & parLayout = par->layout();
if (forcePlainLayout || parLayout == defaultLayout)
ParagraphList::iterator const end = insertion.end();
ParagraphList::iterator par = insertion.begin();
for (; par != end; ++par) {
Layout const & parLayout = par->layout();
ParagraphList::iterator const end = insertion.end();
ParagraphList::iterator par = insertion.begin();
for (; par != end; ++par) {
Layout const & parLayout = par->layout();
// This works without copying any paragraph data because we have
// a specialized swap method for ParagraphList. This is important
// since we store pointers to insets at some places and we don't
// This works without copying any paragraph data because we have
// a specialized swap method for ParagraphList. This is important
// since we store pointers to insets at some places and we don't
for (pos_type i = 0; i < tmpbuf->size(); ++i) {
// do not track deletion of invalid insets
if (Inset * inset = tmpbuf->getInset(i))
for (pos_type i = 0; i < tmpbuf->size(); ++i) {
// do not track deletion of invalid insets
if (Inset * inset = tmpbuf->getInset(i))
// merge the first par of the insertion with the current par
mergeParagraph(buffer.params(), pars, pit);
}
// merge the first par of the insertion with the current par
mergeParagraph(buffer.params(), pars, pit);
}
// some kind of garbage collection there, or a shared_ptr, then this
// would not be needed.
static Buffer * buffer = theBufferList().newBuffer(
// some kind of garbage collection there, or a shared_ptr, then this
// would not be needed.
static Buffer * buffer = theBufferList().newBuffer(
pit_type startpit, pit_type endpit,
int start, int end, DocumentClass const * const dc, CutStack & cutstack)
{
pit_type startpit, pit_type endpit,
int start, int end, DocumentClass const * const dc, CutStack & cutstack)
{
ParagraphList::const_iterator pit = pars.begin();
ParagraphList::const_iterator pend = pars.end();
for (; pit != pend; ++pit) {
ParagraphList::const_iterator pit = pars.begin();
ParagraphList::const_iterator pend = pars.end();
for (; pit != pend; ++pit) {
- asciiSel += pit->asString(AS_STR_INSETS);
+ Paragraph par(*pit, 0, 26);
+ // adapt paragraph to current buffer.
+ par.setBuffer(const_cast<Buffer &>(*buf));
+ asciiSel += par.asString(AS_STR_INSETS);
if (asciiSel.size() > 25) {
asciiSel.replace(22, docstring::npos,
from_ascii("..."));
if (asciiSel.size() > 25) {
asciiSel.replace(22, docstring::npos,
from_ascii("..."));
- // FIXME This should be the empty layout...right?
- par.setLayout(bp.documentClass().emptyLayout());
+ // FIXME This should be the plain layout...right?
+ par.setLayout(bp.documentClass().plainLayout());
par.insert(0, grabSelection(cur), Font(), Change(Change::UNCHANGED));
pars.push_back(par);
cutstack.push(make_pair(pars, bp.documentClassPtr()));
par.insert(0, grabSelection(cur), Font(), Change(Change::UNCHANGED));
pars.push_back(par);
cutstack.push(make_pair(pars, bp.documentClassPtr()));
{
// In tablemode, because copy and paste actually use special table stack
// we do not attempt to get selected paragraphs under cursor. Instead, a
{
// In tablemode, because copy and paste actually use special table stack
// we do not attempt to get selected paragraphs under cursor. Instead, a
par.insert(0, plaintext, Font(), Change(Change::UNCHANGED));
pars.push_back(par);
theCuts.push(make_pair(pars, bp.documentClassPtr()));
par.insert(0, plaintext, Font(), Change(Change::UNCHANGED));
pars.push_back(par);
theCuts.push(make_pair(pars, bp.documentClassPtr()));
{
// This function is called, not when a selection is formed, but when
// a selection is cleared. Therefore, multiple keyboard selection
{
// This function is called, not when a selection is formed, but when
// a selection is cleared. Therefore, multiple keyboard selection