par.insertInset(par.size(), new InsetLine, font, change);
} else if (token == "\\change_unchanged") {
change = Change(Change::UNCHANGED);
- } else if (token == "\\change_inserted") {
+ } else if (token == "\\change_inserted" || token == "\\change_deleted") {
lex.eatLine();
istringstream is(lex.getString());
unsigned int aid;
time_t ct;
is >> aid >> ct;
- if (aid >= bp.author_map.size()) {
+ map<unsigned int, int> const & am = bp.author_map;
+ if (am.find(aid) == am.end()) {
errorList.push_back(ErrorItem(_("Change tracking error"),
- bformat(_("Unknown author index for insertion: %1$d\n"), aid),
+ bformat(_("Unknown author index for change: %1$d\n"), aid),
par.id(), 0, par.size()));
change = Change(Change::UNCHANGED);
- } else
- change = Change(Change::INSERTED, bp.author_map[aid], ct);
- } else if (token == "\\change_deleted") {
- lex.eatLine();
- istringstream is(lex.getString());
- unsigned int aid;
- time_t ct;
- is >> aid >> ct;
- if (aid >= bp.author_map.size()) {
- errorList.push_back(ErrorItem(_("Change tracking error"),
- bformat(_("Unknown author index for deletion: %1$d\n"), aid),
- par.id(), 0, par.size()));
- change = Change(Change::UNCHANGED);
- } else
- change = Change(Change::DELETED, bp.author_map[aid], ct);
+ } else {
+ 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"),
cur.checkBufferStructure();
// cur.updateFlags(Update::Force);
- setCursor(cur.top(), cur.pit(), cur.pos() + 1);
+ bool boundary = tm.isRTLBoundary(cur.pit(), cur.pos() + 1);
+ setCursor(cur, cur.pit(), cur.pos() + 1, false, boundary);
charInserted(cur);
}
LASSERT(this == cur.text(), /**/);
if (!cur.selection()) {
- Change const & change = cur.paragraph().lookupChange(cur.pos());
- if (!(change.changed() && findNextChange(&cur.bv())))
+ bool const changed = cur.paragraph().isChanged(cur.pos());
+ if (!(changed && findNextChange(&cur.bv())))
return;
}
pos_type right = (pit == endPit ? endPos : parSize);
if (op == ACCEPT) {
- pars_[pit].acceptChanges(cur.buffer()->params(), left, right);
+ pars_[pit].acceptChanges(left, right);
} else {
- pars_[pit].rejectChanges(cur.buffer()->params(), left, right);
+ pars_[pit].rejectChanges(left, right);
}
}
// (do not consider end-of-par)
for (pit_type pit = 0; pit < pars_size; ++pit) {
if (!pars_[pit].empty()) // prevent assertion failure
- pars_[pit].rejectChanges(bparams, 0, pars_[pit].size());
+ pars_[pit].rejectChanges(0, pars_[pit].size());
}
// next, reject imaginary end-of-par characters
// restore position
cur.pit() = min(cur.lastpit(), spit);
cur.pos() = min(cur.lastpos(), spos);
- }
+ } else
+ // this is the least that needs to be done (bug 6003)
+ // in the above case, pasteParagraphList handles this
+ cur.buffer()->updateLabels();
cur.clearSelection();
cur.resetAnchor();
return true;
Change change = par.lookupChange(cur.pos());
- if (change.type != Change::UNCHANGED) {
+ if (change.changed()) {
Author const & a = buf.params().authors().get(change.author);
os << _("Change: ") << a.name();
if (!a.email().empty())