mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-22 07:42:02 +00:00
A saner way to reset paragraphs to default when inserting inset around selection
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20888 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
dddcccfebe
commit
0f4d519108
@ -12,6 +12,7 @@ InsetLayout Marginal
|
||||
Color Red
|
||||
Size Small
|
||||
EndFont
|
||||
MultiPar true
|
||||
End
|
||||
|
||||
InsetLayout Foot
|
||||
@ -22,6 +23,7 @@ InsetLayout Foot
|
||||
Color Green
|
||||
Size Small
|
||||
EndFont
|
||||
MultiPar true
|
||||
End
|
||||
|
||||
InsetLayout Note:Comment
|
||||
@ -33,6 +35,7 @@ InsetLayout Note:Comment
|
||||
Color comment
|
||||
Size Small
|
||||
EndFont
|
||||
MultiPar true
|
||||
End
|
||||
|
||||
|
||||
@ -45,6 +48,7 @@ InsetLayout Note:Note
|
||||
Color note
|
||||
Size Small
|
||||
EndFont
|
||||
MultiPar true
|
||||
End
|
||||
|
||||
InsetLayout Note:Greyedout
|
||||
@ -56,6 +60,7 @@ InsetLayout Note:Greyedout
|
||||
Color greyedout
|
||||
Size Small
|
||||
EndFont
|
||||
MultiPar true
|
||||
End
|
||||
|
||||
InsetLayout Note:Framed
|
||||
@ -67,6 +72,7 @@ InsetLayout Note:Framed
|
||||
Color greyedout
|
||||
Size Small
|
||||
EndFont
|
||||
MultiPar true
|
||||
End
|
||||
|
||||
InsetLayout Note:Shaded
|
||||
@ -78,6 +84,7 @@ InsetLayout Note:Shaded
|
||||
Color greyedout
|
||||
Size Small
|
||||
EndFont
|
||||
MultiPar true
|
||||
End
|
||||
|
||||
InsetLayout ERT
|
||||
@ -91,6 +98,7 @@ InsetLayout ERT
|
||||
Color latex
|
||||
Size Small
|
||||
EndFont
|
||||
MultiPar true
|
||||
End
|
||||
|
||||
InsetLayout Branch
|
||||
@ -99,6 +107,7 @@ InsetLayout Branch
|
||||
Color Red
|
||||
Size Small
|
||||
EndFont
|
||||
MultiPar true
|
||||
End
|
||||
|
||||
InsetLayout Index
|
||||
@ -114,5 +123,10 @@ InsetLayout Index
|
||||
Color Green
|
||||
Size Small
|
||||
EndFont
|
||||
MultiPar false
|
||||
End
|
||||
|
||||
InsetLayout Box
|
||||
MultiPar true
|
||||
End
|
||||
|
||||
|
@ -209,11 +209,26 @@ static bool doInsertInset(Cursor & cur, Text * text,
|
||||
|
||||
if (gotsel && pastesel) {
|
||||
lyx::dispatch(FuncRequest(LFUN_PASTE, "0"));
|
||||
// reset first par to default
|
||||
if (cur.lastpit() != 0 || cur.lastpos() != 0) {
|
||||
InsetLayout il = inset->getLayout(cur.buffer().params());
|
||||
if (!il.multipar || cur.lastpit() == 0) {
|
||||
// reset first par to default
|
||||
LayoutPtr const layout =
|
||||
cur.buffer().params().getTextClass().defaultLayout();
|
||||
cur.text()->paragraphs().begin()->layout(layout);
|
||||
cur.pos() = 0;
|
||||
cur.pit() = 0;
|
||||
// Merge multiple paragraphs -- hack
|
||||
while (cur.lastpit() > 0) {
|
||||
mergeParagraph(cur.buffer().params(),
|
||||
cur.text()->paragraphs(), 0);
|
||||
}
|
||||
} else {
|
||||
// reset surrounding par to default
|
||||
docstring const layoutname =
|
||||
cur.buffer().params().getTextClass().defaultLayoutName();
|
||||
cur.leaveInset(*inset);
|
||||
text->setLayout(cur, layoutname);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user