CutStack theCuts(10);
+// store whether the tabular stack is newer than the normal copy stack
+// FIXME: this is a workaround for bug 1919. Should be removed for 1.5,
+// when we (hopefully) have a one-for-all paste mechanism.
+bool dirty_tabular_stack_;
+
class resetOwnerAndChanges : public std::unary_function<Paragraph, void> {
public:
void operator()(Paragraph & p) const {
all_erased = false;
// Erase all the "middle" paragraphs.
- pars.erase(pars.begin() + startpit + 1, pars.begin() + endpit);
- endpit = startpit + 1;
-
+ if (params.tracking_changes) {
+ // Look through the deleted pars if any, erasing as needed
+ for (pit_type pit = startpit + 1; pit != endpit;) {
+ // "erase" the contents of the par
+ pars[pit].erase(0, pars[pit].size());
+ if (pars[pit].empty()) {
+ // remove the par if it's now empty
+ pars.erase(pars.begin() + pit);
+ --endpit;
+ } else {
+ ++pit;
+ all_erased = false;
+ }
+ }
+ } else {
+ pars.erase(pars.begin() + startpit + 1, pars.begin() + endpit);
+ endpit = startpit + 1;
+ }
+
#if 0 // FIXME: why for cut but not copy ?
// the cut selection should begin with standard layout
if (realcut) {
// need a valid cursor. (Lgb)
cur.clearSelection();
updateCounters(cur.buffer());
+
+ // tell tabular that a recent copy happened
+ dirtyTabularStack(false);
}
if (cur.inMathed()) {
pars.back().insert(0, grabSelection(cur), LyXFont());
theCuts.push(make_pair(pars, bp.textclass));
}
+ // tell tabular that a recent copy happened
+ dirtyTabularStack(false);
}
}
+void dirtyTabularStack(bool b)
+{
+ dirty_tabular_stack_ = b;
+}
+
+
+bool tabularStackDirty()
+{
+ return dirty_tabular_stack_;
+}
+
+
} // namespace cap
} // namespace lyx