Lines Matching refs:el

57 hist_init(EditLine *el)  in hist_init()  argument
60 el->el_history.fun = NULL; in hist_init()
61 el->el_history.ref = NULL; in hist_init()
62 el->el_history.buf = el_calloc(EL_BUFSIZ, sizeof(*el->el_history.buf)); in hist_init()
63 if (el->el_history.buf == NULL) in hist_init()
65 el->el_history.sz = EL_BUFSIZ; in hist_init()
66 el->el_history.last = el->el_history.buf; in hist_init()
75 hist_end(EditLine *el) in hist_end() argument
78 el_free(el->el_history.buf); in hist_end()
79 el->el_history.buf = NULL; in hist_end()
87 hist_set(EditLine *el, hist_fun_t fun, void *ptr) in hist_set() argument
90 el->el_history.ref = ptr; in hist_set()
91 el->el_history.fun = fun; in hist_set()
101 hist_get(EditLine *el) in hist_get() argument
107 if (el->el_history.eventno == 0) { /* if really the current line */ in hist_get()
108 (void) wcsncpy(el->el_line.buffer, el->el_history.buf, in hist_get()
109 el->el_history.sz); in hist_get()
110 el->el_line.lastchar = el->el_line.buffer + in hist_get()
111 (el->el_history.last - el->el_history.buf); in hist_get()
114 if (el->el_map.type == MAP_VI) in hist_get()
115 el->el_line.cursor = el->el_line.buffer; in hist_get()
118 el->el_line.cursor = el->el_line.lastchar; in hist_get()
122 if (el->el_history.ref == NULL) in hist_get()
125 hp = HIST_FIRST(el); in hist_get()
130 for (h = 1; h < el->el_history.eventno; h++) in hist_get()
131 if ((hp = HIST_NEXT(el)) == NULL) in hist_get()
135 blen = (size_t)(el->el_line.limit - el->el_line.buffer); in hist_get()
136 if (hlen > blen && !ch_enlargebufs(el, hlen)) in hist_get()
139 memcpy(el->el_line.buffer, hp, hlen * sizeof(*hp)); in hist_get()
140 el->el_line.lastchar = el->el_line.buffer + hlen - 1; in hist_get()
142 if (el->el_line.lastchar > el->el_line.buffer in hist_get()
143 && el->el_line.lastchar[-1] == '\n') in hist_get()
144 el->el_line.lastchar--; in hist_get()
145 if (el->el_line.lastchar > el->el_line.buffer in hist_get()
146 && el->el_line.lastchar[-1] == ' ') in hist_get()
147 el->el_line.lastchar--; in hist_get()
149 if (el->el_map.type == MAP_VI) in hist_get()
150 el->el_line.cursor = el->el_line.buffer; in hist_get()
153 el->el_line.cursor = el->el_line.lastchar; in hist_get()
157 el->el_history.eventno = h; in hist_get()
167 hist_command(EditLine *el, int argc, const wchar_t **argv) in hist_command() argument
173 if (el->el_history.ref == NULL) in hist_command()
182 for (str = HIST_LAST(el); str != NULL; str = HIST_PREV(el)) { in hist_command()
184 ct_encode_string(str, &el->el_scratch); in hist_command()
199 (void) fprintf(el->el_outfile, "%d\t%s\n", in hist_command()
212 return history_w(el->el_history.ref, &ev, H_SETSIZE, num); in hist_command()
215 return history_w(el->el_history.ref, &ev, H_SETUNIQUE, num); in hist_command()
226 hist_enlargebuf(EditLine *el, size_t oldsz, size_t newsz) in hist_enlargebuf() argument
230 newbuf = el_realloc(el->el_history.buf, newsz * sizeof(*newbuf)); in hist_enlargebuf()
236 el->el_history.last = newbuf + in hist_enlargebuf()
237 (el->el_history.last - el->el_history.buf); in hist_enlargebuf()
238 el->el_history.buf = newbuf; in hist_enlargebuf()
239 el->el_history.sz = newsz; in hist_enlargebuf()
245 hist_convert(EditLine *el, int fn, void *arg) in hist_convert() argument
248 if ((*(el)->el_history.fun)((el)->el_history.ref, &ev, fn, arg) == -1) in hist_convert()
251 &el->el_scratch); in hist_convert()