Lines Matching refs:el

54 hist_init(EditLine *el)  in hist_init()  argument
57 el->el_history.fun = NULL; in hist_init()
58 el->el_history.ref = NULL; in hist_init()
59 el->el_history.buf = el_malloc(EL_BUFSIZ * sizeof(*el->el_history.buf)); in hist_init()
60 el->el_history.sz = EL_BUFSIZ; in hist_init()
61 if (el->el_history.buf == NULL) in hist_init()
63 el->el_history.last = el->el_history.buf; in hist_init()
72 hist_end(EditLine *el) in hist_end() argument
75 el_free(el->el_history.buf); in hist_end()
76 el->el_history.buf = NULL; in hist_end()
84 hist_set(EditLine *el, hist_fun_t fun, void *ptr) in hist_set() argument
87 el->el_history.ref = ptr; in hist_set()
88 el->el_history.fun = fun; in hist_set()
98 hist_get(EditLine *el) in hist_get() argument
103 if (el->el_history.eventno == 0) { /* if really the current line */ in hist_get()
104 (void) Strncpy(el->el_line.buffer, el->el_history.buf, in hist_get()
105 el->el_history.sz); in hist_get()
106 el->el_line.lastchar = el->el_line.buffer + in hist_get()
107 (el->el_history.last - el->el_history.buf); in hist_get()
110 if (el->el_map.type == MAP_VI) in hist_get()
111 el->el_line.cursor = el->el_line.buffer; in hist_get()
114 el->el_line.cursor = el->el_line.lastchar; in hist_get()
118 if (el->el_history.ref == NULL) in hist_get()
121 hp = HIST_FIRST(el); in hist_get()
126 for (h = 1; h < el->el_history.eventno; h++) in hist_get()
127 if ((hp = HIST_NEXT(el)) == NULL) { in hist_get()
128 el->el_history.eventno = h; in hist_get()
131 (void) Strncpy(el->el_line.buffer, hp, in hist_get()
132 (size_t)(el->el_line.limit - el->el_line.buffer)); in hist_get()
133 el->el_line.buffer[el->el_line.limit - el->el_line.buffer - 1] = '\0'; in hist_get()
134 el->el_line.lastchar = el->el_line.buffer + Strlen(el->el_line.buffer); in hist_get()
136 if (el->el_line.lastchar > el->el_line.buffer in hist_get()
137 && el->el_line.lastchar[-1] == '\n') in hist_get()
138 el->el_line.lastchar--; in hist_get()
139 if (el->el_line.lastchar > el->el_line.buffer in hist_get()
140 && el->el_line.lastchar[-1] == ' ') in hist_get()
141 el->el_line.lastchar--; in hist_get()
143 if (el->el_map.type == MAP_VI) in hist_get()
144 el->el_line.cursor = el->el_line.buffer; in hist_get()
147 el->el_line.cursor = el->el_line.lastchar; in hist_get()
157 hist_command(EditLine *el, int argc, const Char **argv) in hist_command() argument
163 if (el->el_history.ref == NULL) in hist_command()
169 for (str = HIST_LAST(el); str != NULL; str = HIST_PREV(el)) in hist_command()
170 (void) fprintf(el->el_outfile, "%d %s", in hist_command()
171 el->el_history.ev.num, ct_encode_string(str, &el->el_scratch)); in hist_command()
181 return FUNW(history)(el->el_history.ref, &ev, H_SETSIZE, num); in hist_command()
184 return FUNW(history)(el->el_history.ref, &ev, H_SETUNIQUE, num); in hist_command()
195 hist_enlargebuf(EditLine *el, size_t oldsz, size_t newsz) in hist_enlargebuf() argument
199 newbuf = el_realloc(el->el_history.buf, newsz * sizeof(*newbuf)); in hist_enlargebuf()
205 el->el_history.last = newbuf + in hist_enlargebuf()
206 (el->el_history.last - el->el_history.buf); in hist_enlargebuf()
207 el->el_history.buf = newbuf; in hist_enlargebuf()
208 el->el_history.sz = newsz; in hist_enlargebuf()
215 hist_convert(EditLine *el, int fn, void *arg) in hist_convert() argument
218 if ((*(el)->el_history.fun)((el)->el_history.ref, &ev, fn, arg) == -1) in hist_convert()
221 &el->el_scratch); in hist_convert()