154211Sbostic /*- 254211Sbostic * Copyright (c) 1992 The Regents of the University of California. 354211Sbostic * All rights reserved. 454211Sbostic * 554211Sbostic * This code is derived from software contributed to Berkeley by 654211Sbostic * Christos Zoulas of Cornell University. 754211Sbostic * 854211Sbostic * %sccs.include.redist.c% 954211Sbostic * 10*54246Smarc * @(#)chared.h 5.2 (Berkeley) 06/22/92 1154211Sbostic */ 1254211Sbostic 1354211Sbostic /* 1454211Sbostic * el.chared.h: Character editor interface 1554211Sbostic */ 1654211Sbostic #ifndef _h_el_chared 1754211Sbostic #define _h_el_chared 1854211Sbostic 1954211Sbostic #include <ctype.h> 2054211Sbostic #include <string.h> 2154211Sbostic 22*54246Smarc #include "histedit.h" 2354211Sbostic 2454211Sbostic #define EL_MAXMACRO 10 2554211Sbostic 2654211Sbostic /* 2754211Sbostic * This is a issue of basic "vi" look-and-feel. Defining VI_MOVE works 2854211Sbostic * like real vi: i.e. the transition from command<->insert modes moves 2954211Sbostic * the cursor. 3054211Sbostic * 3154211Sbostic * On the other hand we really don't want to move the cursor, because 3254211Sbostic * all the editing commands don't include the character under the cursor. 3354211Sbostic * Probably the best fix is to make all the editing commands aware of 3454211Sbostic * this fact. 3554211Sbostic */ 3654211Sbostic #define VI_MOVE 3754211Sbostic 3854211Sbostic 3954211Sbostic typedef struct c_macro_t { 4054211Sbostic int level; 4154211Sbostic char **macro; 4254211Sbostic } c_macro_t; 4354211Sbostic 4454211Sbostic /* 4554211Sbostic * Undo information for both vi and emacs 4654211Sbostic */ 4754211Sbostic typedef struct c_undo_t { 4854211Sbostic int action; 4954211Sbostic int isize; 5054211Sbostic int dsize; 5154211Sbostic char *ptr; 5254211Sbostic char *buf; 5354211Sbostic } c_undo_t; 5454211Sbostic 5554211Sbostic /* 5654211Sbostic * Current action information for vi 5754211Sbostic */ 5854211Sbostic typedef struct c_vcmd_t { 5954211Sbostic int action; 6054211Sbostic char *pos; 6154211Sbostic char *ins; 6254211Sbostic } c_vcmd_t; 6354211Sbostic 6454211Sbostic /* 6554211Sbostic * Kill buffer for emacs 6654211Sbostic */ 6754211Sbostic typedef struct c_kill_t { 6854211Sbostic char *buf; 6954211Sbostic char *last; 7054211Sbostic char *mark; 7154211Sbostic } c_kill_t; 7254211Sbostic 7354211Sbostic /* 7454211Sbostic * Note that we use both data structures because the user can bind 7554211Sbostic * commands from both editors! 7654211Sbostic */ 7754211Sbostic typedef struct el_chared_t { 7854211Sbostic c_undo_t c_undo; 7954211Sbostic c_kill_t c_kill; 8054211Sbostic c_vcmd_t c_vcmd; 8154211Sbostic c_macro_t c_macro; 8254211Sbostic } el_chared_t; 8354211Sbostic 8454211Sbostic 8554211Sbostic #define STReof "^D\b\b" 8654211Sbostic #define STRQQ "\"\"" 8754211Sbostic 8854211Sbostic #define isglob(a) (strchr("*[]?", (a)) != NULL) 8954211Sbostic #define isword(a) (isprint(a)) 9054211Sbostic 9154211Sbostic #define NOP 0x00 9254211Sbostic #define DELETE 0x01 9354211Sbostic #define INSERT 0x02 9454211Sbostic #define CHANGE 0x04 9554211Sbostic 9654211Sbostic #define CHAR_FWD 0 9754211Sbostic #define CHAR_BACK 1 9854211Sbostic 9954211Sbostic #define MODE_INSERT 0 10054211Sbostic #define MODE_REPLACE 1 10154211Sbostic #define MODE_REPLACE_1 2 10254211Sbostic 10354211Sbostic #include "vi.h" 10454211Sbostic #include "emacs.h" 10554211Sbostic #include "common.h" 10654211Sbostic #include "search.h" 10754211Sbostic #include "fcns.h" 10854211Sbostic 10954211Sbostic 11054211Sbostic protected int cv__isword __P((int)); 11154211Sbostic protected void cv_delfini __P((EditLine *)); 11254211Sbostic protected char *cv__endword __P((char *, char *, int)); 11354211Sbostic protected int ce__isword __P((int)); 11454211Sbostic protected void cv_undo __P((EditLine *, int, int, char *)); 11554211Sbostic protected char *cv_next_word __P((EditLine*, char *, char *, int, 11654211Sbostic int (*)(int))); 11754211Sbostic protected char *cv_prev_word __P((EditLine*, char *, char *, int, 11854211Sbostic int (*)(int))); 11954211Sbostic protected char *c__next_word __P((char *, char *, int, int (*)(int))); 12054211Sbostic protected char *c__prev_word __P((char *, char *, int, int (*)(int))); 12154211Sbostic protected void c_insert __P((EditLine *, int)); 12254211Sbostic protected void c_delbefore __P((EditLine *, int)); 12354211Sbostic protected void c_delafter __P((EditLine *, int)); 12454211Sbostic protected int c_gets __P((EditLine *, char *)); 12554211Sbostic protected int c_hpos __P((EditLine *)); 12654211Sbostic 12754211Sbostic protected int ch_init __P((EditLine *)); 12854211Sbostic protected void ch_reset __P((EditLine *)); 12954211Sbostic protected void ch_end __P((EditLine *)); 13054211Sbostic 13154211Sbostic #endif /* _h_el_chared */ 132