Lines Matching +full:no +full:- +full:ref +full:- +full:current +full:- +full:limit
3 /*-
25 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
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()
64 return -1; 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()
78 el_free(el->el_history.buf); in hist_end()
79 el->el_history.buf = NULL; in hist_end()
90 el->el_history.ref = ptr; in hist_set()
91 el->el_history.fun = fun; in hist_set()
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()
130 for (h = 1; h < el->el_history.eventno; h++) in hist_get()
135 blen = (size_t)(el->el_line.limit - el->el_line.buffer); 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()
173 if (el->el_history.ref == NULL) in hist_command()
174 return -1; in hist_command()
184 ct_encode_string(str, &el->el_scratch); in hist_command()
186 if (len > 0 && ptr[len - 1] == '\n') in hist_command()
187 ptr[--len] = '\0'; in hist_command()
194 return -1; in hist_command()
199 (void) fprintf(el->el_outfile, "%d\t%s\n", in hist_command()
207 return -1; 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()
217 return -1; in hist_command()
230 newbuf = el_realloc(el->el_history.buf, newsz * sizeof(*newbuf)); in hist_enlargebuf()
234 (void) memset(&newbuf[oldsz], '\0', (newsz - oldsz) * 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()
248 if ((*(el)->el_history.fun)((el)->el_history.ref, &ev, fn, arg) == -1) in hist_convert()
251 &el->el_scratch); in hist_convert()