diff options
author | Otto Moerbeek <otto@cvs.openbsd.org> | 2003-10-31 08:42:25 +0000 |
---|---|---|
committer | Otto Moerbeek <otto@cvs.openbsd.org> | 2003-10-31 08:42:25 +0000 |
commit | 6ff1c1765c2b4495f0292fe730d9bb9a5daef063 (patch) | |
tree | f9b79c5d3b01533c847610f8410f66661df68535 /lib/libedit/chared.h | |
parent | 4c1c60ce562b0cf6d8cb6e2e49e2b53193359874 (diff) |
Update to NetBSD libedit (from Oct 1, 2003), adding some string
cleaning and history bug fixes. The code includes GNU libreadline
functionality, but the corresponding header files are not installed,
since some libreadline functions are missing. There are some minor API
changes, notably:
old: EditLine *el_init(const char *, FILE *, FILE *);
new: EditLine *el_init(const char *, FILE *, FILE *, FILE *);
old: HistEvent *history(History *h, int op, ...);
new: int history(History *h, HistEvent *ev, int op, ...); plus some
changes in operation names. See editline(3) for details.
Tested by djm@, mouring@, jmc@.
ok deraadt@
Diffstat (limited to 'lib/libedit/chared.h')
-rw-r--r-- | lib/libedit/chared.h | 126 |
1 files changed, 69 insertions, 57 deletions
diff --git a/lib/libedit/chared.h b/lib/libedit/chared.h index 4a506f9dd35..8192eace5ee 100644 --- a/lib/libedit/chared.h +++ b/lib/libedit/chared.h @@ -1,5 +1,5 @@ -/* $OpenBSD: chared.h,v 1.6 2003/06/02 20:18:40 millert Exp $ */ -/* $NetBSD: chared.h,v 1.2 1997/01/11 06:47:49 lukem Exp $ */ +/* $OpenBSD: chared.h,v 1.7 2003/10/31 08:42:24 otto Exp $ */ +/* $NetBSD: chared.h,v 1.12 2003/08/07 16:44:30 agc Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -39,61 +39,69 @@ * el.chared.h: Character editor interface */ #ifndef _h_el_chared -#define _h_el_chared +#define _h_el_chared #include <ctype.h> #include <string.h> #include "histedit.h" -#define EL_MAXMACRO 10 +#define EL_MAXMACRO 10 /* * This is a issue of basic "vi" look-and-feel. Defining VI_MOVE works * like real vi: i.e. the transition from command<->insert modes moves * the cursor. * - * On the other hand we really don't want to move the cursor, because + * On the other hand we really don't want to move the cursor, because * all the editing commands don't include the character under the cursor. * Probably the best fix is to make all the editing commands aware of * this fact. */ -#define VI_MOVE +#define VI_MOVE typedef struct c_macro_t { - int level; - char **macro; - char *nline; + int level; + char **macro; + char *nline; } c_macro_t; -/* - * Undo information for both vi and emacs +/* + * Undo information for vi - no undo in emacs (yet) */ typedef struct c_undo_t { - int action; - int isize; - int dsize; - char *ptr; - char *buf; + int len; /* length of saved line */ + int cursor; /* position of saved cursor */ + char *buf; /* full saved text */ } c_undo_t; +/* redo for vi */ +typedef struct c_redo_t { + char *buf; /* redo insert key sequence */ + char *pos; + char *lim; + el_action_t cmd; /* command to redo */ + char ch; /* char that invoked it */ + int count; + int action; /* from cv_action() */ +} c_redo_t; + /* * Current action information for vi */ typedef struct c_vcmd_t { - int action; - char *pos; - char *ins; + int action; + char *pos; } c_vcmd_t; /* * Kill buffer for emacs */ typedef struct c_kill_t { - char *buf; - char *last; - char *mark; + char *buf; + char *last; + char *mark; } c_kill_t; /* @@ -101,30 +109,31 @@ typedef struct c_kill_t { * commands from both editors! */ typedef struct el_chared_t { - c_undo_t c_undo; - c_kill_t c_kill; - c_vcmd_t c_vcmd; - c_macro_t c_macro; + c_undo_t c_undo; + c_kill_t c_kill; + c_redo_t c_redo; + c_vcmd_t c_vcmd; + c_macro_t c_macro; } el_chared_t; -#define STReof "^D\b\b" -#define STRQQ "\"\"" +#define STReof "^D\b\b" +#define STRQQ "\"\"" -#define isglob(a) (strchr("*[]?", (a)) != NULL) -#define isword(a) (isprint(a)) +#define isglob(a) (strchr("*[]?", (a)) != NULL) +#define isword(a) (isprint(a)) -#define NOP 0x00 -#define DELETE 0x01 -#define INSERT 0x02 -#define CHANGE 0x04 +#define NOP 0x00 +#define DELETE 0x01 +#define INSERT 0x02 +#define YANK 0x04 -#define CHAR_FWD 0 -#define CHAR_BACK 1 +#define CHAR_FWD (+1) +#define CHAR_BACK (-1) -#define MODE_INSERT 0 -#define MODE_REPLACE 1 -#define MODE_REPLACE_1 2 +#define MODE_INSERT 0 +#define MODE_REPLACE 1 +#define MODE_REPLACE_1 2 #include "common.h" #include "vi.h" @@ -133,23 +142,26 @@ typedef struct el_chared_t { #include "fcns.h" -protected int cv__isword(int); -protected void cv_delfini(EditLine *); -protected char *cv__endword(char *, char *, int); -protected int ce__isword(int); -protected void cv_undo(EditLine *, int, int, char *); -protected char *cv_next_word(EditLine*, char *, char *, int, int (*)(int)); -protected char *cv_prev_word(EditLine*, char *, char *, int, int (*)(int)); -protected char *c__next_word(char *, char *, int, int (*)(int)); -protected char *c__prev_word(char *, char *, int, int (*)(int)); -protected void c_insert(EditLine *, int); -protected void c_delbefore(EditLine *, int); -protected void c_delafter(EditLine *, int); -protected int c_gets(EditLine *, char *); -protected int c_hpos(EditLine *); - -protected int ch_init(EditLine *); -protected void ch_reset(EditLine *); -protected void ch_end(EditLine *); +protected int cv__isword(int); +protected int cv__isWord(int); +protected void cv_delfini(EditLine *); +protected char *cv__endword(char *, char *, int, int (*)(int)); +protected int ce__isword(int); +protected void cv_undo(EditLine *); +protected void cv_yank(EditLine *, const char *, int); +protected char *cv_next_word(EditLine*, char *, char *, int, int (*)(int)); +protected char *cv_prev_word(char *, char *, int, int (*)(int)); +protected char *c__next_word(char *, char *, int, int (*)(int)); +protected char *c__prev_word(char *, char *, int, int (*)(int)); +protected void c_insert(EditLine *, int); +protected void c_delbefore(EditLine *, int); +protected void c_delafter(EditLine *, int); +protected int c_gets(EditLine *, char *, const char *); +protected int c_hpos(EditLine *); + +protected int ch_init(EditLine *); +protected void ch_reset(EditLine *); +protected int ch_enlargebufs(EditLine *, size_t); +protected void ch_end(EditLine *); #endif /* _h_el_chared */ |