50
52
#include <sys/types.h>
52
#define EL_BUFSIZ 1024 /* Maximum line size */
54
#define EL_BUFSIZ ((size_t)4096) /* Maximum line size */
54
#define HANDLE_SIGNALS 0x01
56
#define EDIT_DISABLED 0x04
57
#define UNBUFFERED 0x08
56
#define HANDLE_SIGNALS 0x01
58
#define EDIT_DISABLED 0x04
59
#define UNBUFFERED 0x08
60
#define CHARSET_IS_MULTIBYTE 0x10
61
#define IGNORE_EXTCHARS 0x20 /* Ignore characters read > 0xff */
62
#define NARROW_HISTORY 0x40
63
#define NARROW_READ 0x80
59
65
typedef int bool_t; /* True or not */
68
74
typedef struct el_line_t {
69
char *buffer; /* Input line */
70
char *cursor; /* Cursor position */
71
char *lastchar; /* Last character */
72
const char *limit; /* Max position */
75
Char *buffer; /* Input line */
76
Char *cursor; /* Cursor position */
77
Char *lastchar; /* Last character */
78
const Char *limit; /* Max position */
82
88
int metanext; /* Is the next char a meta char */
83
89
el_action_t lastcmd; /* Previous command */
84
90
el_action_t thiscmd; /* this command */
85
char thisch; /* char that generated it */
91
Char thisch; /* char that generated it */
89
95
* Until we come up with something better...
91
#define el_strdup(a) strdup(a)
92
97
#define el_malloc(a) malloc(a)
93
98
#define el_realloc(a,b) realloc(a, b)
94
99
#define el_free(a) free(a)
97
102
#include "prompt.h"
103
#include "keymacro.h"
104
#include "el_terminal.h"
100
105
#include "refresh.h"
101
106
#include "chared.h"
102
107
#include "common.h"
109
114
#include "read.h"
111
116
struct editline {
112
char *el_prog; /* the program name */
117
Char *el_prog; /* the program name */
113
118
FILE *el_infile; /* Stdio stuff */
114
119
FILE *el_outfile; /* Stdio stuff */
115
120
FILE *el_errfile; /* Stdio stuff */
116
121
int el_infd; /* Input file descriptor */
122
int el_outfd; /* Output file descriptor */
123
int el_errfd; /* Error file descriptor */
117
124
int el_flags; /* Various flags. */
125
int el_errno; /* Local copy of errno */
118
126
coord_t el_cursor; /* Cursor location */
119
char **el_display; /* Real screen image = what is there */
120
char **el_vdisplay; /* Virtual screen image = what we see */
127
Char **el_display; /* Real screen image = what is there */
128
Char **el_vdisplay; /* Virtual screen image = what we see */
121
129
void *el_data; /* Client data */
122
130
el_line_t el_line; /* The current line information */
123
131
el_state_t el_state; /* Current editor state */
124
el_term_t el_term; /* Terminal dependent stuff */
132
el_terminal_t el_terminal; /* Terminal dependent stuff */
125
133
el_tty_t el_tty; /* Tty dependent stuff */
126
134
el_refresh_t el_refresh; /* Refresh stuff */
127
135
el_prompt_t el_prompt; /* Prompt stuff */
128
136
el_prompt_t el_rprompt; /* Prompt stuff */
129
137
el_chared_t el_chared; /* Characted editor stuff */
130
138
el_map_t el_map; /* Key mapping stuff */
131
el_key_t el_key; /* Key binding stuff */
139
el_keymacro_t el_keymacro; /* Key binding stuff */
132
140
el_history_t el_history; /* History stuff */
133
141
el_search_t el_search; /* Search stuff */
134
142
el_signal_t el_signal; /* Signal handling stuff */
135
143
el_read_t el_read; /* Character reading stuff */
145
ct_buffer_t el_scratch; /* Scratch conversion buffer */
146
ct_buffer_t el_lgcyconv; /* Buffer for legacy wrappers */
147
LineInfo el_lgcylinfo; /* Legacy LineInfo buffer */
138
protected int el_editmode(EditLine *, int, const char **);
151
protected int el_editmode(EditLine *, int, const Char **);
140
153
/* XXXMYSQL: Bug#23097 mysql can't insert korean on mysql prompt. */
141
154
#define el_isprint(x) ((unsigned char) (x) < 0x80 ? isprint(x) : 1)