Path: csiph.com!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: Ben Bacarisse Newsgroups: comp.programming Subject: Re: Undo / Redo design pattern. Date: Tue, 05 Apr 2022 02:25:39 +0100 Organization: A noiseless patient Spider Lines: 20 Message-ID: <87fsms5njg.fsf@bsb.me.uk> References: <7dd390a8-2947-43b7-af05-2ca9c5c3bfb4n@googlegroups.com> <69b65fe6-1c26-4288-9ad1-7d08f6ed0d97n@googlegroups.com> <8c77e04d-e729-4711-813c-67c9b0ee053fn@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: reader02.eternal-september.org; posting-host="82c5355b4ca4145157ddc0f2a8d127da"; logging-data="15852"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18vay9YGBg4/5SVHrG4iCOAacpAr+Jb04c=" Cancel-Lock: sha1:KOUcOSq+3kcfyGNmEnAAaE7P+e8= sha1:MEHRvyknhINv1S+CE/d4KIfT7+E= X-BSB-Auth: 1.7e6b01f86bfde22c4e33.20220405022539BST.87fsms5njg.fsf@bsb.me.uk Xref: csiph.com comp.programming:14790 Malcolm McLean writes: > You need two stacks because after a series of undos, you have a series > of redos. This is just a random observation that might trigger something useful in more complex situations... Emacs has what I find to be a very useful refinement of undo/redo: it can be limited to a region of the text. Say I delete most of the quoted material in a reply (Emacs is my Usenet client), and then make a few remarks at the end of the post, maybe doing some undo or redo operations. If I now realise I need some of the stuff I delete for context, I can highlight the top of my reply and undo in the selected region only. The big delete will be undone, and I can then do the more selective editing I now know I need. -- Ben.