diff options
author | Vincent Labrecque <vincent@cvs.openbsd.org> | 2002-02-20 22:30:55 +0000 |
---|---|---|
committer | Vincent Labrecque <vincent@cvs.openbsd.org> | 2002-02-20 22:30:55 +0000 |
commit | 91eb8ee9aef24fa169241287d3c2e873f22b8159 (patch) | |
tree | d35a08609150239b38bd0da79ab3b2379c4159dd /usr.bin/mg/def.h | |
parent | 8989fddc5af6aa6535367a7d737f11fdba7710cd (diff) |
Add undo code to mg.
needs further hacking.
ok `whole bunch of people on icb'@
Diffstat (limited to 'usr.bin/mg/def.h')
-rw-r--r-- | usr.bin/mg/def.h | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/usr.bin/mg/def.h b/usr.bin/mg/def.h index 0ee13e9d86b..7c5a5c57984 100644 --- a/usr.bin/mg/def.h +++ b/usr.bin/mg/def.h @@ -1,4 +1,6 @@ -/* $OpenBSD: def.h,v 1.29 2002/02/16 21:27:49 millert Exp $ */ +/* $OpenBSD: def.h,v 1.30 2002/02/20 22:30:54 vincent Exp $ */ + +#include <sys/queue.h> /* * This file is the general header file for all parts @@ -252,6 +254,26 @@ typedef struct { } REGION; /* + * This structure holds information about recent actions for the Undo command. + */ +struct undo_rec { + LIST_ENTRY(undo_rec) next; + BUFFER *buf; + enum { + INSERT = 1, + DELETE, + CHANGE, + BOUNDARY + } type; + REGION region; + int pos; + int size; + char *content; +}; + +LIST_HEAD(undo_list, undo_rec); + +/* * Prototypes. */ @@ -490,6 +512,8 @@ int lowerregion(int, int); int upperregion(int, int); int prefixregion(int, int); int setprefix(int, int); +int region_get_data(REGION *, char *, int); +int region_put_data(const char *, int); /* search.c X */ int forwsearch(int, int); @@ -545,6 +569,15 @@ int cntmatchlines(int, int); int cntnonmatchlines(int, int); #endif /* REGEX */ +/* undo.c X */ +int undo_init(void); +int undo_enable(int); +int undo_add_boundary(void); +int undo_add_insert(LINE *, int, int); +int undo_add_delete(LINE *, int, int); +int undo_add_change(LINE *, int, int); +int undo(void); + /* * Externals. */ @@ -565,6 +598,7 @@ extern int ttcol; extern int tttop; extern int ttbot; extern int tthue; +extern int undoaction; extern int defb_nmodes; extern int defb_flag; extern const char cinfo[]; @@ -580,4 +614,3 @@ extern char prompt[]; int tceeol; int tcinsl; int tcdell; - |