diff options
| author | Quentin Carbonneaux | 2014-08-11 10:53:20 -0400 |
|---|---|---|
| committer | Quentin Carbonneaux | 2014-08-11 10:53:20 -0400 |
| commit | 49a65f30941e169322279a49028460785fa186e7 (patch) | |
| tree | 638af6bf16f35ff0a085b3d471d904b15c205eb8 | |
| parent | f34630de77662c720401e4b411dc5bf06eb8e3f9 (diff) | |
fix revision management for edit buffers
Two bugs are now gone. When undoing, the current revision
number was not properly reset to the previous one. Revisions
corresponding to new modifications need new numbers, so we
keep a static variable 'grev' to generate fresh revision
numbers.
| -rw-r--r-- | edit.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -90,8 +90,10 @@ log_revision(Log *l) void log_commit(Log *l, unsigned rev) { + static unsigned grev = 1; + if (!rev) - rev = log_revision(l) + 1; + rev = ++grev; pushlog(l, Commit); l->p0 = rev; } @@ -139,10 +141,12 @@ log_undo(Log *l, Buf *b, Log *redo, unsigned *pp) l = n; } + p0 = top->p0; + top->p0 = l->p0; top->next = l->next; free(l); if (redo) - log_commit(redo, top->p0); + log_commit(redo, p0); } Log * |
