ParagraphList & pars, pit_type par_offset, pos_type pos)
{
// create a new paragraph
- Paragraph & tmp = *pars.insert(next(pars.begin(), par_offset + 1),
+ Paragraph & tmp = *pars.insert(lyx::next(pars.begin(), par_offset + 1),
Paragraph());
Paragraph & par = pars[par_offset];
string const & token, Font & font, Change & change, ErrorList & errorList)
{
Buffer * buf = const_cast<Buffer *>(&owner_->buffer());
- BufferParams const & bp = buf->params();
+ BufferParams & bp = buf->params();
if (token[0] != '\\') {
docstring dstr = lex.getDocString();
int aid;
time_t ct;
is >> aid >> ct;
- BufferParams::AuthorMap const & am = bp.author_map;
+ BufferParams::AuthorMap const & am = bp.author_map_;
if (am.find(aid) == am.end()) {
- errorList.push_back(ErrorItem(_("Change tracking error"),
- bformat(_("Unknown author index for change: %1$d\n"), aid),
- par.id(), 0, par.size()));
- change = Change(Change::UNCHANGED);
- } else {
- if (token == "\\change_inserted")
- change = Change(Change::INSERTED, am.find(aid)->second, ct);
- else
- change = Change(Change::DELETED, am.find(aid)->second, ct);
+ errorList.push_back(ErrorItem(
+ _("Change tracking author index missing"),
+ bformat(_("A change tracking author information for index "
+ "%1$d is missing. This can happen after a wrong "
+ "merge by a version control system. In this case, "
+ "either fix the merge, or have this information "
+ "missing until the corresponding tracked changes "
+ "are merged or this user edits the file again.\n"),
+ aid),
+ par.id(), par.size(), par.size() + 1
+ ));
+ bp.addAuthor(Author(aid));
}
+ if (token == "\\change_inserted")
+ change = Change(Change::INSERTED, am.find(aid)->second, ct);
+ else
+ change = Change(Change::DELETED, am.find(aid)->second, ct);
} else {
lex.eatLine();
errorList.push_back(ErrorItem(_("Unknown token"),
ParagraphList & pars = text.paragraphs();
// create a new paragraph, and insert into the list
ParagraphList::iterator tmp =
- pars.insert(next(pars.begin(), par_offset + 1),
+ pars.insert(lyx::next(pars.begin(), par_offset + 1),
Paragraph());
Paragraph & par = pars[par_offset];
{
LBUFERR(this == cur.text());
CursorSlice from = cur.top();
- CursorSlice to = cur.top();
+ CursorSlice to;
getWord(from, to, loc);
if (cur.top() != from)
setCursor(cur, from.pit(), from.pos());
if (cur.lastpos() == 0
|| (cur.lastpos() == 1 && par.isSeparator(0))) {
cur.recordUndo(prevcur.pit());
- plist.erase(next(plist.begin(), cur.pit()));
+ plist.erase(lyx::next(plist.begin(), cur.pit()));
needsUpdate = true;
}
// is previous par empty?
else if (prevcur.lastpos() == 0
|| (prevcur.lastpos() == 1 && prevpar.isSeparator(0))) {
cur.recordUndo(prevcur.pit());
- plist.erase(next(plist.begin(), prevcur.pit()));
+ plist.erase(lyx::next(plist.begin(), prevcur.pit()));
needsUpdate = true;
}
// Pasting is not allowed, if the paragraphs have different
}
-void Text::forOutliner(docstring & os, size_t maxlen, bool shorten) const
+void Text::shortenForOutliner(docstring & str, size_t const maxlen)
+{
+ support::truncateWithEllipsis(str, maxlen);
+ docstring::iterator it = str.begin();
+ docstring::iterator end = str.end();
+ for (; it != end; ++it)
+ if ((*it) == L'\n' || (*it) == L'\t')
+ (*it) = L' ';
+}
+
+
+void Text::forOutliner(docstring & os, size_t const maxlen,
+ bool const shorten) const
{
- LASSERT(maxlen >= 8, maxlen = TOC_ENTRY_LENGTH);
- for (size_t i = 0; i != pars_.size() && os.length() < maxlen; ++i)
- pars_[i].forOutliner(os, maxlen);
- if (shorten && os.length() >= maxlen)
- os = os.substr(0, maxlen - 3) + from_ascii("...");
+ size_t tmplen = shorten ? maxlen + 1 : maxlen;
+ for (size_t i = 0; i != pars_.size() && os.length() < tmplen; ++i)
+ pars_[i].forOutliner(os, tmplen, false);
+ if (shorten)
+ shortenForOutliner(os, maxlen);
}