[Inquiry]GNUCash SoC - Implementing Undo

Ariel asgnucash at dsgml.com
Wed Mar 28 00:14:48 EDT 2007


On Tue, 27 Mar 2007, Nathan Buchanan wrote:

> On 3/27/07, Ariel <asgnucash at dsgml.com> wrote:

>> Let the user cherry pick which transaction to undo - it doesn't have to
>> be in strict reverse order.

> This sounds a bit complicated for the average user, if we do decide to let
> the user cherry pick, we need to have a very clear UI/warning  about undoing
> transactions out of order. The fact is that most people think of things in a
> specific order, and whenever we allow going backward (undoing) in a
> different order, we need to be crystal clear about it.

When I enter transactions, usually there is no order, one transaction has 
nothing to do with another. It's not always like that obviously, but I 
think changes to transactions are the primary 'atom' here. Not changes to 
gnucash as a whole, so there is no reason not to do this.

By making undo keep track of changed transactions, rather then total 
program state I think it makes the code easier - undo piggy backs on top 
of the transaction log.

Each time something is written to the log, it's also written to undo - in 
fact a large part of undo is already written: the log already records a 
before and after, all you need to do is put in a gui to see each entry in 
the log and you are all set.

There was debate earlier on where to 'attach' the undo, to the register 
view, to an account, etc - I say just use the transaction log, you know it 
works and it's already written.

> Also, how would redo work (when it gets implemented)? Say a user makes
> change 1, 2, 3 and 4. ,Then the user undoes change 1 then change 3. Does
> redo redo change 3 then change 1? This may be difficult for the user to keep
> straight.

Yes, remember: when you undo something it goes in the log exactly as if 
you had typed it yourself. So when you undo something, then the 'undo' in 
and of itself goes in the undo list. So redo is just undo twice.

 	-Ariel


More information about the gnucash-devel mailing list