mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-24 02:35:20 +00:00
When breaking an empty paragraph reduces depth, set layout too
This requires an adaptation of the Separator inset insertion code,
which has been duly provided by Enrico.
(cherry picked from commit b162bd6d2b
)
This commit is contained in:
parent
b040985a2b
commit
4fa54014d7
@ -764,9 +764,13 @@ void Text::breakParagraph(Cursor & cur, bool inverse_logic)
|
||||
Layout const & layout = cpar.layout();
|
||||
|
||||
if (cur.lastpos() == 0 && !cpar.allowEmpty()) {
|
||||
if (changeDepthAllowed(cur, DEC_DEPTH))
|
||||
if (changeDepthAllowed(cur, DEC_DEPTH)) {
|
||||
changeDepth(cur, DEC_DEPTH);
|
||||
else {
|
||||
pit_type const prev = depthHook(cpit, cpar.getDepth());
|
||||
docstring const & lay = pars_[prev].layout().name();
|
||||
if (lay != layout.name())
|
||||
setLayout(cur, lay);
|
||||
} else {
|
||||
docstring const & lay = cur.paragraph().usePlainLayout()
|
||||
? tclass.plainLayoutName() : tclass.defaultLayoutName();
|
||||
if (lay != layout.name())
|
||||
|
@ -1088,13 +1088,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
|
||||
Paragraph const & par = pars_[pit];
|
||||
bool lastpar = (pit == pit_type(pars_.size() - 1));
|
||||
Paragraph const & nextpar = lastpar ? par : pars_[pit + 1];
|
||||
pit_type prev = pit;
|
||||
if (pit > 0) {
|
||||
if (!pars_[pit - 1].layout().isEnvironment())
|
||||
prev = depthHook(pit, par.getDepth());
|
||||
else if (pars_[pit - 1].getDepth() >= par.getDepth())
|
||||
prev = pit - 1;
|
||||
}
|
||||
pit_type prev = pit > 0 ? depthHook(pit, par.getDepth()) : pit;
|
||||
if (prev < pit && cur.pos() == par.beginOfBody()
|
||||
&& !par.size() && !par.isEnvSeparator(cur.pos())
|
||||
&& !par.layout().isCommand()
|
||||
|
Loading…
Reference in New Issue
Block a user