Lines Matching defs:el

46 #include "el.h"
52 hist_init(EditLine *el)
55 el->el_history.fun = NULL;
56 el->el_history.ref = NULL;
57 el->el_history.buf = (char *) el_malloc(EL_BUFSIZ);
58 el->el_history.sz = EL_BUFSIZ;
59 if (el->el_history.buf == NULL)
61 el->el_history.last = el->el_history.buf;
70 hist_end(EditLine *el)
73 el_free((ptr_t) el->el_history.buf);
74 el->el_history.buf = NULL;
82 hist_set(EditLine *el, hist_fun_t fun, ptr_t ptr)
85 el->el_history.ref = ptr;
86 el->el_history.fun = fun;
96 hist_get(EditLine *el)
101 if (el->el_history.eventno == 0) { /* if really the current line */
102 (void) strncpy(el->el_line.buffer, el->el_history.buf,
103 el->el_history.sz);
104 el->el_line.lastchar = el->el_line.buffer +
105 (el->el_history.last - el->el_history.buf);
108 if (el->el_map.type == MAP_VI)
109 el->el_line.cursor = el->el_line.buffer;
112 el->el_line.cursor = el->el_line.lastchar;
116 if (el->el_history.ref == NULL)
119 hp = HIST_FIRST(el);
124 for (h = 1; h < el->el_history.eventno; h++)
125 if ((hp = HIST_NEXT(el)) == NULL) {
126 el->el_history.eventno = h;
129 (void) strlcpy(el->el_line.buffer, hp,
130 (size_t)(el->el_line.limit - el->el_line.buffer));
131 el->el_line.lastchar = el->el_line.buffer + strlen(el->el_line.buffer);
133 if (el->el_line.lastchar > el->el_line.buffer
134 && el->el_line.lastchar[-1] == '\n')
135 el->el_line.lastchar--;
136 if (el->el_line.lastchar > el->el_line.buffer
137 && el->el_line.lastchar[-1] == ' ')
138 el->el_line.lastchar--;
140 if (el->el_map.type == MAP_VI)
141 el->el_line.cursor = el->el_line.buffer;
144 el->el_line.cursor = el->el_line.lastchar;
154 hist_command(EditLine *el, int argc, const char **argv)
160 if (el->el_history.ref == NULL)
166 for (str = HIST_LAST(el); str != NULL; str = HIST_PREV(el))
167 (void) fprintf(el->el_outfile, "%d %s",
168 el->el_history.ev.num, str);
178 return history(el->el_history.ref, &ev, H_SETSIZE, num);
181 return history(el->el_history.ref, &ev, H_SETUNIQUE, num);
192 hist_enlargebuf(EditLine *el, size_t oldsz, size_t newsz)
196 newbuf = realloc(el->el_history.buf, newsz);
202 el->el_history.last = newbuf +
203 (el->el_history.last - el->el_history.buf);
204 el->el_history.buf = newbuf;
205 el->el_history.sz = newsz;