mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-31 23:52:03 +00:00
Allow backspace, etc, to merge paragraphs even if they have different styles.
Patch from Daniel. This is bug #11917. Master only.
This commit is contained in:
parent
2952c78ea5
commit
6834321a50
14
src/Text.cpp
14
src/Text.cpp
@ -1685,10 +1685,7 @@ bool Text::backspacePos0(Cursor & cur)
|
|||||||
if (cur.pit() == 0)
|
if (cur.pit() == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
bool needsUpdate = false;
|
|
||||||
|
|
||||||
BufferParams const & bufparams = cur.buffer()->params();
|
BufferParams const & bufparams = cur.buffer()->params();
|
||||||
DocumentClass const & tclass = bufparams.documentClass();
|
|
||||||
ParagraphList & plist = cur.text()->paragraphs();
|
ParagraphList & plist = cur.text()->paragraphs();
|
||||||
Paragraph const & par = cur.paragraph();
|
Paragraph const & par = cur.paragraph();
|
||||||
Cursor prevcur = cur;
|
Cursor prevcur = cur;
|
||||||
@ -1701,14 +1698,12 @@ bool Text::backspacePos0(Cursor & cur)
|
|||||||
|| (cur.lastpos() == 1 && par.isSeparator(0))) {
|
|| (cur.lastpos() == 1 && par.isSeparator(0))) {
|
||||||
cur.recordUndo(prevcur.pit());
|
cur.recordUndo(prevcur.pit());
|
||||||
plist.erase(plist.iterator_at(cur.pit()));
|
plist.erase(plist.iterator_at(cur.pit()));
|
||||||
needsUpdate = true;
|
|
||||||
}
|
}
|
||||||
// is previous par empty?
|
// is previous par empty?
|
||||||
else if (prevcur.lastpos() == 0
|
else if (prevcur.lastpos() == 0
|
||||||
|| (prevcur.lastpos() == 1 && prevpar.isSeparator(0))) {
|
|| (prevcur.lastpos() == 1 && prevpar.isSeparator(0))) {
|
||||||
cur.recordUndo(prevcur.pit());
|
cur.recordUndo(prevcur.pit());
|
||||||
plist.erase(plist.iterator_at(prevcur.pit()));
|
plist.erase(plist.iterator_at(prevcur.pit()));
|
||||||
needsUpdate = true;
|
|
||||||
}
|
}
|
||||||
// FIXME: Do we really not want to allow this???
|
// FIXME: Do we really not want to allow this???
|
||||||
// Pasting is not allowed, if the paragraphs have different
|
// Pasting is not allowed, if the paragraphs have different
|
||||||
@ -1716,20 +1711,15 @@ bool Text::backspacePos0(Cursor & cur)
|
|||||||
// word processors to allow it. It confuses the user.
|
// word processors to allow it. It confuses the user.
|
||||||
// Correction: Pasting is always allowed with standard-layout
|
// Correction: Pasting is always allowed with standard-layout
|
||||||
// or the empty layout.
|
// or the empty layout.
|
||||||
else if (par.layout() == prevpar.layout()
|
else {
|
||||||
|| tclass.isDefaultLayout(par.layout())
|
|
||||||
|| tclass.isPlainLayout(par.layout())) {
|
|
||||||
cur.recordUndo(prevcur.pit());
|
cur.recordUndo(prevcur.pit());
|
||||||
mergeParagraph(bufparams, plist, prevcur.pit());
|
mergeParagraph(bufparams, plist, prevcur.pit());
|
||||||
needsUpdate = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (needsUpdate) {
|
|
||||||
cur.forceBufferUpdate();
|
cur.forceBufferUpdate();
|
||||||
setCursorIntern(cur, prevcur.pit(), prevcur.pos());
|
setCursorIntern(cur, prevcur.pit(), prevcur.pos());
|
||||||
}
|
|
||||||
|
|
||||||
return needsUpdate;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user