ListOfBuffers Buffer::allRelatives() const
{
ListOfBuffers lb = masterBuffer()->getDescendents();
- lb.push_front(const_cast<Buffer *>(this));
+ lb.push_front(const_cast<Buffer *>(masterBuffer()));
return lb;
}
// LaTeX backend
else if (backend_format == format) {
runparams.nice = true;
- if (!makeLaTeXFile(FileName(filename), string(), runparams))
+ if (!makeLaTeXFile(FileName(filename), string(), runparams)) {
+ if (d->cloned_buffer_) {
+ d->cloned_buffer_->d->errorLists["Export"] =
+ d->errorLists["Export"];
+ }
return false;
+ }
} else if (!lyxrc.tex_allows_spaces
&& contains(filePath(), ' ')) {
Alert::error(_("File name error"),
return false;
} else {
runparams.nice = false;
- if (!makeLaTeXFile(FileName(filename), filePath(), runparams))
+ if (!makeLaTeXFile(FileName(filename), filePath(), runparams)) {
+ if (d->cloned_buffer_) {
+ d->cloned_buffer_->d->errorLists["Export"] =
+ d->errorLists["Export"];
+ }
return false;
+ }
}
string const error_type = (format == "program")
void Buffer::bufferErrors(TeXErrors const & terr, ErrorList & errorList) const
{
- TeXErrors::Errors::const_iterator cit = terr.begin();
+ TeXErrors::Errors::const_iterator it = terr.begin();
TeXErrors::Errors::const_iterator end = terr.end();
+ ListOfBuffers clist = getDescendents();
+ ListOfBuffers::const_iterator cen = clist.end();
- for (; cit != end; ++cit) {
+ for (; it != end; ++it) {
int id_start = -1;
int pos_start = -1;
- int errorRow = cit->error_in_line;
- bool found = d->texrow.getIdFromRow(errorRow, id_start,
- pos_start);
+ int errorRow = it->error_in_line;
+ Buffer const * buf = 0;
+ Impl const * p = d;
+ if (it->child_name.empty())
+ p->texrow.getIdFromRow(errorRow, id_start, pos_start);
+ else {
+ // The error occurred in a child
+ ListOfBuffers::const_iterator cit = clist.begin();
+ for (; cit != cen; ++cit) {
+ string const child_name =
+ DocFileName(changeExtension(
+ (*cit)->absFileName(), "tex")).
+ mangledFileName();
+ if (it->child_name != child_name)
+ continue;
+ (*cit)->d->texrow.getIdFromRow(errorRow,
+ id_start, pos_start);
+ if (id_start != -1) {
+ buf = d->cloned_buffer_
+ ? (*cit)->d->cloned_buffer_->d->owner_
+ : (*cit)->d->owner_;
+ p = (*cit)->d;
+ break;
+ }
+ }
+ }
int id_end = -1;
int pos_end = -1;
+ bool found;
do {
++errorRow;
- found = d->texrow.getIdFromRow(errorRow, id_end, pos_end);
+ found = p->texrow.getIdFromRow(errorRow, id_end, pos_end);
} while (found && id_start == id_end && pos_start == pos_end);
- errorList.push_back(ErrorItem(cit->error_desc,
- cit->error_text, id_start, pos_start, pos_end));
+ if (id_start != id_end) {
+ // Next registered position is outside the inset where
+ // the error occurred, so signal end-of-paragraph
+ pos_end = 0;
+ }
+
+ errorList.push_back(ErrorItem(it->error_desc,
+ it->error_text, id_start, pos_start, pos_end, buf));
}
}