/// If there was an error when previewing, on the next preview we do
/// a fresh compile (e.g. in case the user installed a package that
/// was missing).
- bool preview_error_;
+ bool require_fresh_start_;
/// Cache the references associated to a label and their positions
/// in the buffer.
+ (with_blanks ? blank_count_ : 0);
}
- // does the buffer contain tracked changes? (if so, we automatically
- // display the review toolbar, for instance)
- mutable bool tracked_changes_present_;
-
// Make sure the file monitor monitors the good file.
void refreshFileMonitor();
file_fully_loaded(false), file_format(LYX_FORMAT), need_format_backup(false),
ignore_parent(false), toc_backend(owner), macro_lock(false),
checksum_(0), wa_(0), gui_(0), undo_(*owner), bibinfo_cache_valid_(false),
- cite_labels_valid_(false), have_bibitems_(false), preview_error_(false),
+ cite_labels_valid_(false), have_bibitems_(false), require_fresh_start_(false),
inset(0), preview_loader_(0), cloned_buffer_(cloned_buffer),
clone_list_(0), doing_export(false),
- tracked_changes_present_(0), externally_modified_(false), parent_buffer(0),
+ externally_modified_(false), parent_buffer(0),
word_count_(0), char_count_(0), blank_count_(0)
{
refreshFileMonitor();
layout_position = cloned_buffer_->d->layout_position;
preview_file_ = cloned_buffer_->d->preview_file_;
preview_format_ = cloned_buffer_->d->preview_format_;
- preview_error_ = cloned_buffer_->d->preview_error_;
- tracked_changes_present_ = cloned_buffer_->d->tracked_changes_present_;
+ require_fresh_start_ = cloned_buffer_->d->require_fresh_start_;
}
readHeader(lex);
if (params().output_changes) {
- bool dvipost = LaTeXFeatures::isAvailable("dvipost");
bool xcolorulem = LaTeXFeatures::isAvailable("ulem") &&
LaTeXFeatures::isAvailable("xcolor");
- if (!dvipost && !xcolorulem) {
+ if (!xcolorulem) {
Alert::warning(_("Changes not shown in LaTeX output"),
_("Changes will not be highlighted in LaTeX output, "
- "because neither dvipost nor xcolor/ulem are installed.\n"
- "Please install these packages or redefine "
- "\\lyxadded and \\lyxdeleted in the LaTeX preamble."));
- } else if (!xcolorulem) {
- Alert::warning(_("Changes not shown in LaTeX output"),
- _("Changes will not be highlighted in LaTeX output "
- "when using pdflatex, because xcolor and ulem are not installed.\n"
+ "because xcolor and ulem are not installed.\n"
"Please install both packages or redefine "
"\\lyxadded and \\lyxdeleted in the LaTeX preamble."));
}
}
-bool Buffer::lastPreviewError() const
+bool Buffer::freshStartRequired() const
+{
+ return d->require_fresh_start_;
+}
+
+void Buffer::requireFreshStart(bool const b) const
{
- return d->preview_error_;
+ d->require_fresh_start_ = b;
}
os << "\\catcode`\\%=11"
"\\def\\%{%}\\catcode`\\%=14\n";
}
- bool const detokenize = !isAscii(from_utf8(docdir))
- || contains(docdir, '~');
+ if (contains(docdir, '~'))
+ docdir = subst(docdir, "~", "\\string~");
+ bool const nonascii = !isAscii(from_utf8(docdir));
+ // LaTeX 2019/10/01 handles non-ascii path without detokenize
+ bool const utfpathlatex = features.isAvailable("LaTeX-2019/10/01");
+ bool const detokenize = !utfpathlatex && nonascii;
bool const quote = contains(docdir, ' ');
+ if (utfpathlatex && nonascii)
+ os << "\\UseRawInputEncoding\n";
os << "\\makeatletter\n"
<< "\\def\\input@path{{";
if (detokenize)
runparams.use_babel = params().writeLaTeX(os, features,
d->filename.onlyPath());
+ // Active characters
+ runparams.active_chars = features.getActiveChars();
+
// Biblatex bibliographies are loaded here
if (params().useBiblatex()) {
vector<pair<docstring, string>> const bibfiles =
if (params().save_transient_properties)
undo().recordUndoBufferParams(CursorData());
params().track_changes = !params().track_changes;
- if (!params().track_changes)
- dr.forceChangesUpdate();
break;
case LFUN_CHANGES_OUTPUT:
undo().recordUndoBufferParams(CursorData());
params().output_changes = !params().output_changes;
if (params().output_changes) {
- bool dvipost = LaTeXFeatures::isAvailable("dvipost");
bool xcolorulem = LaTeXFeatures::isAvailable("ulem") &&
LaTeXFeatures::isAvailable("xcolor");
- if (!dvipost && !xcolorulem) {
+ if (!xcolorulem) {
Alert::warning(_("Changes not shown in LaTeX output"),
_("Changes will not be highlighted in LaTeX output, "
- "because neither dvipost nor xcolor/ulem are installed.\n"
- "Please install these packages or redefine "
- "\\lyxadded and \\lyxdeleted in the LaTeX preamble."));
- } else if (!xcolorulem) {
- Alert::warning(_("Changes not shown in LaTeX output"),
- _("Changes will not be highlighted in LaTeX output "
- "when using pdflatex, because xcolor and ulem are not installed.\n"
+ "because xcolor and ulem are not installed.\n"
"Please install both packages or redefine "
"\\lyxadded and \\lyxdeleted in the LaTeX preamble."));
}
for (ParConstIterator it = par_iterator_begin(); it != end; ++it)
it->getLanguages(langs);
// also children
- ListOfBuffers clist = getDescendents();
+ ListOfBuffers clist = getDescendants();
for (auto const & cit : clist)
cit->getLanguages(langs);
}
ListOfBuffers Buffer::allRelatives() const
{
- ListOfBuffers lb = masterBuffer()->getDescendents();
+ ListOfBuffers lb = masterBuffer()->getDescendants();
lb.push_front(const_cast<Buffer *>(masterBuffer()));
return lb;
}
}
-ListOfBuffers Buffer::getDescendents() const
+ListOfBuffers Buffer::getDescendants() const
{
ListOfBuffers v;
collectChildren(v, true);
if (it == m.begin())
return m.end();
- it--;
+ --it;
return it;
}
return;
string const paramName = "key";
+ UndoGroupHelper ugh(this);
InsetIterator it = inset_iterator_begin(inset());
for (; it; ++it) {
if (it->lyxCode() != CITE_CODE)
continue;
InsetCommand * inset = it->asInsetCommand();
docstring const oldValue = inset->getParam(paramName);
- if (oldValue == from)
+ if (oldValue == from) {
+ undo().recordUndo(CursorData(it));
inset->setParam(paramName, to);
+ }
}
}
void Buffer::setExportStatus(bool e) const
{
d->doing_export = e;
- ListOfBuffers clist = getDescendents();
+ ListOfBuffers clist = getDescendants();
for (auto const & bit : clist)
bit->d->doing_export = e;
}
else
errors(error_type);
// also to the children, in case of master-buffer-view
- ListOfBuffers clist = getDescendents();
+ ListOfBuffers clist = getDescendants();
for (auto const & bit : clist) {
if (runparams.silent)
bit->d->errorLists[error_type].clear();
result_file = dest_filename;
// We need to copy referenced files (e. g. included graphics
// if format == "dvi") to the result dir.
- vector<ExportedFile> const files =
+ vector<ExportedFile> const extfiles =
runparams.exportdata->externalFiles(format);
string const dest = runparams.export_folder.empty() ?
onlyPath(result_file) : runparams.export_folder;
: force_overwrite == ALL_FILES;
CopyStatus status = use_force ? FORCE : SUCCESS;
- for (ExportedFile const & exp : files) {
+ for (ExportedFile const & exp : extfiles) {
if (status == CANCEL) {
message(_("Document export cancelled."));
return ExportCancel;
Impl * theimpl = isClone() ? d->cloned_buffer_->d : d;
theimpl->preview_file_ = previewFile;
theimpl->preview_format_ = format;
- theimpl->preview_error_ = (status != ExportSuccess);
+ theimpl->require_fresh_start_ = (status != ExportSuccess);
if (status != ExportSuccess)
return status;
tie(start, end) = p->texrow.getEntriesFromRow(errorRow);
else {
// The error occurred in a child
- for (Buffer const * child : owner_->getDescendents()) {
+ for (Buffer const * child : owner_->getDescendants()) {
string const child_name =
DocFileName(changeExtension(child->absFileName(), "tex")).
mangledFileName();
// update all caches
clearReferenceCache();
updateMacros();
- setChangesPresent(false);
Buffer & cbuf = const_cast<Buffer &>(*this);
// if we are reloading, then we could have a dangling TOC,
clearReferenceCache();
// we should not need to do this again?
// updateMacros();
- setChangesPresent(false);
updateBuffer(parit, utype);
// this will already have been done by reloadBibInfoCache();
// d->bibinfo_cache_valid_ = true;
depth_type maxdepth = 0;
pit_type const lastpit = parit.lastpit();
+ bool changed = false;
for ( ; parit.pit() <= lastpit ; ++parit.pit()) {
// reduce depth if necessary
if (parit->params().depth() > maxdepth) {
// set the counter for this paragraph
d->setLabel(parit, utype);
- // update change-tracking flag
- parit->addChangesToBuffer(*this);
-
// now the insets
for (auto const & insit : parit->insetList()) {
parit.pos() = insit.pos;
insit.inset->updateBuffer(parit, utype);
+ changed |= insit.inset->isChanged();
}
+
+ // are there changes in this paragraph?
+ changed |= parit->isChanged();
}
+
+ // set change indicator for the inset (or the cell that the iterator
+ // points to, if applicable).
+ parit.text()->inset().isChanged(changed);
}
}
+bool Buffer::areChangesPresent() const
+{
+ return inset().isChanged();
+}
+
+
Buffer::ReadStatus Buffer::reload()
{
setBusy(true);
}
-void Buffer::setChangesPresent(bool b) const
-{
- d->tracked_changes_present_ = b;
-}
-
-
-bool Buffer::areChangesPresent() const
-{
- return d->tracked_changes_present_;
-}
-
-
-void Buffer::updateChangesPresent() const
-{
- LYXERR(Debug::CHANGES, "Buffer::updateChangesPresent");
- setChangesPresent(false);
- ParConstIterator it = par_iterator_begin();
- ParConstIterator const end = par_iterator_end();
- for (; !areChangesPresent() && it != end; ++it)
- it->addChangesToBuffer(*this);
-}
-
-
void Buffer::Impl::refreshFileMonitor()
{
if (file_monitor_ && file_monitor_->filename() == filename.absFileName()) {