// The clone needs its own DocumentClass, since running updateBuffer() will
// modify it, and we would otherwise be sharing it with the original Buffer.
- buffer_clone->params().makeDocumentClass();
+ buffer_clone->params().makeDocumentClass(true);
ErrorList el;
cap::switchBetweenClasses(
params().documentClassPtr(), buffer_clone->params().documentClassPtr(),
// The clone needs its own DocumentClass, since running updateBuffer() will
// modify it, and we would otherwise be sharing it with the original Buffer.
- buffer_clone->params().makeDocumentClass();
+ buffer_clone->params().makeDocumentClass(true);
ErrorList el;
cap::switchBetweenClasses(
params().documentClassPtr(), buffer_clone->params().documentClassPtr(),
}
}
- if (!params().master.empty()) {
+ if (!parent() && !params().master.empty()) {
FileName const master_file = makeAbsPath(params().master,
onlyPath(absFileName()));
if (isLyXFileName(master_file.absFileName())) {
TempFile const tempfile("Buffer_importStringXXXXXX." + fmt->extension());
FileName const name(tempfile.name());
ofdocstream os(name.toFilesystemEncoding().c_str());
- bool const success = (os << contents);
+ // Do not convert os implicitly to bool, since that is forbidden in C++11.
+ bool const success = !(os << contents).fail();
os.close();
bool converted = false;
msg += ("\n");
msg += bformat(_("Branch \"%1$s\" already exists."), branch_name);
} else {
+ undo().recordUndoFullDocument(CursorData());
branch_list.add(branch_name);
branch = branch_list.find(branch_name);
string const x11hexname = X11hexname(branch->color());
if (master != this) {
bufToUpdate.insert(this);
master->updateBuffer(UpdateMaster, utype);
- // Do this here in case the master has no gui associated with it. Then,
- // the TocModel is not updated and TocModel::toc_ is invalid (bug 5699).
- if (!master->d->gui_)
+ // If the master buffer has no gui associated with it, then the TocModel is
+ // not updated during the updateBuffer call and TocModel::toc_ is invalid
+ // (bug 5699). The same happens if the master buffer is open in a different
+ // window. This test catches both possibilities.
+ // See: http://marc.info/?l=lyx-devel&m=138590578911716&w=2
+ // There remains a problem here: If there is another child open in yet a third
+ // window, that TOC is not updated. So some more general solution is needed at
+ // some point.
+ if (master->d->gui_ != d->gui_)
structureChanged();
// was buf referenced from the master (i.e. not in bufToUpdate anymore)?