Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.programming    |    Programming issues that transcend langua    |    57,431 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 55,658 of 57,431    |
|    Julio Di Egidio to Malcolm McLean    |
|    Re: Undo / Redo design pattern.    |
|    04 Apr 22 01:03:29    |
      From: julio@diegidio.name              On Sunday, 3 April 2022 at 13:16:14 UTC+2, Malcolm McLean wrote:       > To implement a simple undo redo, you need two stacks, and a copyable       representation of the program state. You then push to the undo stack, with       straight forwards extensions for redo.               Why two stacks? I just see the need for one. And why "program state", this       is usually about a specific set of properties along some tree hierarchy so       that each property is identified by a unique path... and then, in a basic       implementation, at any        change you just record the path together with the value before change.              That said, it's hardly the case that any diffing logic can do better than just       recording the old value in the case of "primitive" types: you can do better       for composite objects/arrays, by checking what properties have actually       changed (and extending a        little bit on the notion of changed property path). Anyway this is a further       step...              Julio              --- SoupGate-Win32 v1.05        * Origin: you cannot sedate... all the things you hate (1:229/2)    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca