break;
}
- if (current_layout != layout) {
- LyXText * lt = bv_->getLyXText();
+ bool change_layout = (current_layout != layout);
+ LyXText * lt = bv_->getLyXText();
+ if (!change_layout && lt->selection.set() &&
+ lt->selection.start.par() != lt->selection.end.par())
+ {
+ Paragraph * spar = lt->selection.start.par();
+ Paragraph * epar = lt->selection.end.par()->next();
+ while(spar != epar) {
+ if (spar->layout() != current_layout) {
+ change_layout = true;
+ break;
+ }
+ }
+ }
+ if (change_layout) {
hideCursor();
current_layout = layout;
update(lt,
2002-04-18 Juergen Vigna <jug@sad.it>
+ * BufferView_pimpl.C (Dispatch): fixed to change layout also if one
+ of the selected paragraph does not have the selected layout also if
+ the last one had!
+
+ * text2.C (setLayout): fixed bug which did not change last selected
+ paragraph.
+
* tabular.C (OldFormatRead): check also for \\end_inset as Lars
changed the read and substituted \\end_float with \\end_inset!
// ok we have a selection. This is always between sstart_cur
// and sel_end cursor
cur = sstart_cur;
+ Paragraph * par = sstart_cur.par();
+ Paragraph * epar = send_cur.par()->next();
LyXLayout const & lyxlayout =
textclasslist[bview->buffer()->params.textclass][layout];
do {
- cur.par()->applyLayout(layout);
- makeFontEntriesLayoutSpecific(bview->buffer(), cur.par());
- Paragraph * fppar = cur.par();
+ par->applyLayout(layout);
+ makeFontEntriesLayoutSpecific(bview->buffer(), par);
+ Paragraph * fppar = par;
fppar->params().spaceTop(lyxlayout.fill_top ?
VSpace(VSpace::VFILL)
: VSpace(VSpace::NONE));
VSpace(VSpace::VFILL)
: VSpace(VSpace::NONE));
if (lyxlayout.margintype == MARGIN_MANUAL)
- cur.par()->setLabelWidthString(lyxlayout.labelstring());
+ par->setLabelWidthString(lyxlayout.labelstring());
if (lyxlayout.labeltype != LABEL_BIBLIO
&& fppar->bibkey) {
delete fppar->bibkey;
fppar->bibkey = 0;
}
- if (cur.par() != send_cur.par())
- cur.par(cur.par()->next());
- } while (cur.par() != send_cur.par());
+ cur.par(par);
+ par = par->next();
+ } while (par != epar);
return endpar;
}