Alfredo Braunstein wrote:

> Andre Poenitz wrote:
> 
>> I don't think so.
>> 
>> end_par is indeed the difference to the _end_, not an offset to the
>> begin. This way, both values stay correct even if something is deleted
>> or inserted in the middle.
>>
>> [I am not sure we still need this, though].
> 
> In fact I don't understand why it would be needed.
> 
> But in recordUndo we have:
> 
>         stack.push(Undo(kind, textnum, pit.index(),
>                 first_par, end_par, text->cursor.par(),
>                 text->cursor.pos()));
>         lyxerr << "undo record: " << stack.top() << std::endl;
> 
>         // record the relevant paragraphs
>         ParagraphList & undo_pars = stack.top().pars;
> 
>         ParagraphList & plist = text->ownerParagraphs();
>         ParagraphList::iterator first = plist.begin();
>         advance(first, first_par);
>         ParagraphList::iterator last = plist.begin();
>         advance(last, last_par);
> 
>         for (ParagraphList::iterator it = first; it != last; ++it) {
>                 undo_pars.push_back(*it);
>                 undo_pars.back().id(it->id());
>         }
>         undo_pars.push_back(*last);
>         undo_pars.back().id(last->id());
> 
> If I read this correctly, the paragraphs recorded are from first_par to
> last_par (inclusive).

So I was reading this uncorrectly ;-)

end_par = size() - last_par.

What a strange naming.

Sorry for the noise. Alfredo


Reply via email to