On Fri, 15 Mar 2002, Andre Poenitz wrote: > How does the undo architecture look like? Maybe even one that does not > work on the outer paragraph level only, but on smaller scopes if possible?
Conceptually, you can handle undo by having a stack of documents. Now, you want smaller scope. I presume this is because you want local undo. (You can still do this, just with stacks of paragraphs, but ignore that for now.) If you want local undo, you will still run into the problem of ownership and references to buffer-wide data: Consider a paragraph with an inset that references a buffer-wide bibliographic entry. In the next paragraph, there is another inset that also references this buffer-wide bibliographic entry. Now, you cut the first inset, and then change the bibliographic entry. If you had local undo, you would then be able to undo the first cut, and keep the changing of the bibliographic entry. What should the result be after this local undo? -- There is no simple answer to this question. This is because we need to decide and define what a reference to a buffer-wide entry in fact means. This is exactly the reason why the best solution is to let each inset define this. It is not the job of the parent paragraph to decide what the insets refer to. It is the job of the inset to know what it refers to. Greets, Asger