On Mon, 2006-03-13 at 20:26 +0100, Juergen Spitzmueller wrote: > Martin Vermeer wrote: > > No it is not. The attached is (cursed evo interface!) > > Yes, that's better :-) > Works for me, from a quick test.
Do you think it is tested enough to go into 1.5? Attached the version with relevant comments added. - Martin
Index: changes.h =================================================================== --- changes.h (revision 13312) +++ changes.h (working copy) @@ -84,7 +84,8 @@ /// return true if there is a deleted or unchanged range contained bool isChangeEdited(lyx::pos_type start, lyx::pos_type end) const; - /// remove the given entry + /// remove the given entry. This implies that a character was + /// deleted at pos, and will adjust all range bounds past it void erase(lyx::pos_type pos); /// output latex to mark a transition between two changetypes @@ -134,22 +135,23 @@ typedef std::vector<ChangeRange> ChangeTable; - /// our table of changes + /// our table of changes, every row a range and change descriptor ChangeTable table_; /// change type for an empty paragraph Change::Type empty_type_; - /// handle a delete + /// handle a delete, either logical or physical (see erase) void del(Change change, ChangeTable::size_type pos); - /// handle an add + /// handle an add, adjusting range bounds past it void add(Change change, ChangeTable::size_type pos); - /// merge neighbouring ranges + /// merge neighbouring ranges, assuming that they are abutting + /// (as done by set()) void merge(); - /// consistency check + /// consistency check, needed before merge() void check() const; }; Index: CutAndPaste.C =================================================================== --- CutAndPaste.C (revision 13339) +++ CutAndPaste.C (working copy) @@ -234,7 +234,8 @@ pit = last_paste; pos = pars[last_paste].size(); - // Maybe some pasting. + // Join (conditionally) last pasted paragraph with next one, i.e., + // the tail of the spliced document paragraph if (!empty && last_paste + 1 != pit_type(pars.size())) { if (pars[last_paste + 1].hasSameLayout(pars[last_paste])) { mergeParagraph(buffer.params(), pars, last_paste); Index: paragraph_funcs.C =================================================================== --- paragraph_funcs.C (revision 13339) +++ paragraph_funcs.C (working copy) @@ -236,6 +236,19 @@ pos_type pos_end = next.size() - 1; pos_type pos_insert = par.size(); + // What happens is the following. Later on, moveItem() will copy + // over characters from the next paragraph to be inserted into this + // position. Now, if the first char to be so copied is "red" (i.e., + // marked deleted) and the paragraph break is marked "blue", + // insertChar will trigger (eventually, through record(), and see + // del() and erase() in changes.C) a "hard" character deletion. + // Which doesn't make sense of course at this pos, but the effect is + // to shorten the change range to which this para break belongs, by + // one. It will (should) remain "orphaned", having no CT info to it, + // and check() in changes.C will assert. Setting the para break + // forcibly to "black" prevents this scenario. -- MV 13.3.2006 + par.setChange(par.size(), Change::UNCHANGED); + Change::Type cr = next.lookupChange(next.size()); // ok, now copy the paragraph for (pos_type i = 0, j = 0; i <= pos_end; ++i) {
signature.asc
Description: This is a digitally signed message part