mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-23 10:18:50 +00:00
Fix bugs 4977 and 2018:
http://bugzilla.lyx.org/show_bug.cgi?id=4977 http://bugzilla.lyx.org/show_bug.cgi?id=2018 * Text3.cpp (doInsertInset): do not copy selection to clipboard if we do not intend to paste it later (bug 4977); do not remove space at start of paragraph (bug 2018); make sure the cursor is at the right place after pasting inside inset. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25621 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
5e0da19d1b
commit
5be432fb92
@ -208,7 +208,8 @@ static bool doInsertInset(Cursor & cur, Text * text,
|
||||
|
||||
bool gotsel = false;
|
||||
if (cur.selection()) {
|
||||
lyx::dispatch(FuncRequest(LFUN_CUT));
|
||||
cutSelection(cur, false, pastesel);
|
||||
cur.clearSelection();
|
||||
gotsel = true;
|
||||
}
|
||||
text->insertInset(cur, inset);
|
||||
@ -219,7 +220,10 @@ static bool doInsertInset(Cursor & cur, Text * text,
|
||||
if (!gotsel || !pastesel)
|
||||
return true;
|
||||
|
||||
lyx::dispatch(FuncRequest(LFUN_PASTE, "0"));
|
||||
pasteFromStack(cur, cur.buffer().errorList("Paste"), 0);
|
||||
cur.buffer().errors("Paste");
|
||||
cur.clearSelection(); // bug 393
|
||||
cur.finishUndo();
|
||||
InsetText * insetText = dynamic_cast<InsetText *>(inset);
|
||||
if (insetText && !insetText->allowMultiPar() || cur.lastpit() == 0) {
|
||||
// reset first par to default
|
||||
@ -230,12 +234,13 @@ static bool doInsertInset(Cursor & cur, Text * text,
|
||||
// Merge multiple paragraphs -- hack
|
||||
while (cur.lastpit() > 0)
|
||||
mergeParagraph(bparams, cur.text()->paragraphs(), 0);
|
||||
cur.leaveInset(*inset);
|
||||
} else {
|
||||
cur.leaveInset(*inset);
|
||||
// reset surrounding par to default
|
||||
docstring const layoutname = insetText->usePlainLayout()
|
||||
? bparams.documentClass().emptyLayoutName()
|
||||
: bparams.documentClass().defaultLayoutName();
|
||||
cur.leaveInset(*inset);
|
||||
text->setLayout(cur, layoutname);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user