Abdelrazak Younes wrote:
OK, I see. Well, I think it works that way, but only because
doRecordUndo() only gets called with isFullBuffer being true at this
one point in the code. If it ever got called that way from elsewhere,
you'd have a problem.
I don't see this could happen but we should make sure this doesn't
happen indeed. FWIW, this is the same technique as in mathed.
So it seems to me to be clearer to do this in the constructor.
But then there is no optimisation AFAICS.
Sure there is: You only do the copy if isFullBuffer is true. I'll commit
my version once the freeze is off.
And while we're on micro-optimization ;~/, how about the attached?
Saves a copy.
If it is safe, and it seems to be, all optimisations are welcome. This
one is not micro if you think about it, an undo operation can contains
a lot of material! And I often seen delay with undo/redo when typing
ctrl-z or ctrl-y rapidly.
Indeed. I'll commit that one, too....
rh