From 91eb8ee9aef24fa169241287d3c2e873f22b8159 Mon Sep 17 00:00:00 2001 From: Vincent Labrecque Date: Wed, 20 Feb 2002 22:30:55 +0000 Subject: Add undo code to mg. needs further hacking. ok `whole bunch of people on icb'@ --- usr.bin/mg/def.h | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) (limited to 'usr.bin/mg/def.h') 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 /* * This file is the general header file for all parts @@ -251,6 +253,26 @@ typedef struct { RSIZE r_size; /* Length in characters. */ } 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; - -- cgit v1.2.3