vis
a vi-like editor based on Plan 9's structural regular expressions
git clone https://9o.is/git/vis.git
commit 3746838d7b7c521f666a5eec2a065e00725f422a parent 01d5c5ad208de9c0f1f0565394080a79211163b0 Author: Ryan Chipman <rchipman@mit.edu> Date: Sat, 27 Jun 2015 14:02:57 -0400 Add seq field to Action struct Diffstat:
| M | text.c | | | 8 | ++++++++ |
1 file changed, 8 insertions(+), 0 deletions(-)
diff --git a/text.c b/text.c @@ -99,6 +99,7 @@ struct Action { Action *earlier; /* the previous Action, chronologically */ Action *later; /* the next Action, chronologically */ time_t time; /* when the first change of this action was performed */ + size_t seq; /* a unique, strictly increasing identifier */ }; typedef struct { @@ -342,6 +343,13 @@ static Action *action_alloc(Text *txt) { return NULL; new->time = time(NULL); txt->current_action = new; + + /* set sequence number */ + if (!txt->last_action) + new->seq = 0; + else + new->seq = txt->last_action->seq + 1; + /* set earlier, later pointers */ if (txt->last_action) txt->last_action->later = new;