Lines Matching refs:el

66 #define	__F el->el_errfile
79 re_printstr(EditLine *el, const char *str, char *f, char *t) in re_printstr() argument
96 re_nextline(EditLine *el) in re_nextline() argument
98 el->el_refresh.r_cursor.h = 0; /* reset it. */ in re_nextline()
106 if (el->el_refresh.r_cursor.v + 1 >= el->el_terminal.t_size.v) { in re_nextline()
107 int i, lins = el->el_terminal.t_size.v; in re_nextline()
108 Char *firstline = el->el_vdisplay[0]; in re_nextline()
111 el->el_vdisplay[i - 1] = el->el_vdisplay[i]; in re_nextline()
114 el->el_vdisplay[i - 1] = firstline; in re_nextline()
116 el->el_refresh.r_cursor.v++; in re_nextline()
118 ELRE_ASSERT(el->el_refresh.r_cursor.v >= el->el_terminal.t_size.v, in re_nextline()
120 el->el_refresh.r_cursor.v, el->el_terminal.t_size.v), in re_nextline()
128 re_addc(EditLine *el, Int c) in re_addc() argument
133 re_putc(el, ' ', 1); in re_addc()
134 if ((el->el_refresh.r_cursor.h & 07) == 0) in re_addc()
139 int oldv = el->el_refresh.r_cursor.v; in re_addc()
140 re_putc(el, '\0', 0); /* assure end of line */ in re_addc()
141 if (oldv == el->el_refresh.r_cursor.v) /* XXX */ in re_addc()
142 re_nextline(el); in re_addc()
146 re_putc(el, c, 1); in re_addc()
153 re_putc(el, visbuf[i], 1); in re_addc()
164 re_putc(EditLine *el, Int c, int shift) in re_putc() argument
169 while (shift && (el->el_refresh.r_cursor.h + w > el->el_terminal.t_size.h)) in re_putc()
170 re_putc(el, ' ', 1); in re_putc()
172 el->el_vdisplay[el->el_refresh.r_cursor.v] in re_putc()
173 [el->el_refresh.r_cursor.h] = c; in re_putc()
177 el->el_vdisplay[el->el_refresh.r_cursor.v] in re_putc()
178 [el->el_refresh.r_cursor.h + i] = MB_FILL_CHAR; in re_putc()
183 el->el_refresh.r_cursor.h += w; /* advance to next place */ in re_putc()
184 if (el->el_refresh.r_cursor.h >= el->el_terminal.t_size.h) { in re_putc()
186 el->el_vdisplay[el->el_refresh.r_cursor.v][el->el_terminal.t_size.h] in re_putc()
188 re_nextline(el); in re_putc()
200 re_refresh(EditLine *el) in re_refresh() argument
210 el->el_line.buffer)); in re_refresh()
213 el->el_refresh.r_cursor.h = 0; in re_refresh()
214 el->el_refresh.r_cursor.v = 0; in re_refresh()
217 prompt_print(el, EL_RPROMPT); in re_refresh()
220 el->el_refresh.r_cursor.h = 0; in re_refresh()
221 el->el_refresh.r_cursor.v = 0; in re_refresh()
223 if (el->el_line.cursor >= el->el_line.lastchar) { in re_refresh()
224 if (el->el_map.current == el->el_map.alt in re_refresh()
225 && el->el_line.lastchar != el->el_line.buffer) in re_refresh()
226 el->el_line.cursor = el->el_line.lastchar - 1; in re_refresh()
228 el->el_line.cursor = el->el_line.lastchar; in re_refresh()
234 prompt_print(el, EL_PROMPT); in re_refresh()
238 termsz = el->el_terminal.t_size.h * el->el_terminal.t_size.v; in re_refresh()
239 if (el->el_line.lastchar - el->el_line.buffer > termsz) { in re_refresh()
244 size_t rem = (el->el_line.lastchar-el->el_line.buffer)%termsz; in re_refresh()
246 st = el->el_line.lastchar - rem in re_refresh()
247 - (termsz - (((rem / el->el_terminal.t_size.v) - 1) in re_refresh()
248 * el->el_terminal.t_size.v)); in re_refresh()
251 st = el->el_line.buffer; in re_refresh()
253 for (cp = st; cp < el->el_line.lastchar; cp++) { in re_refresh()
254 if (cp == el->el_line.cursor) { in re_refresh()
257 cur.h = el->el_refresh.r_cursor.h; in re_refresh()
258 cur.v = el->el_refresh.r_cursor.v; in re_refresh()
260 if (w > 1 && el->el_refresh.r_cursor.h + w > in re_refresh()
261 el->el_terminal.t_size.h) { in re_refresh()
266 re_addc(el, *cp); in re_refresh()
270 cur.h = el->el_refresh.r_cursor.h; in re_refresh()
271 cur.v = el->el_refresh.r_cursor.v; in re_refresh()
273 rhdiff = el->el_terminal.t_size.h - el->el_refresh.r_cursor.h - in re_refresh()
274 el->el_rprompt.p_pos.h; in re_refresh()
275 if (el->el_rprompt.p_pos.h && !el->el_rprompt.p_pos.v && in re_refresh()
276 !el->el_refresh.r_cursor.v && rhdiff > 1) { in re_refresh()
283 re_putc(el, ' ', 1); in re_refresh()
284 prompt_print(el, EL_RPROMPT); in re_refresh()
286 el->el_rprompt.p_pos.h = 0; /* flag "not using rprompt" */ in re_refresh()
287 el->el_rprompt.p_pos.v = 0; in re_refresh()
290 re_putc(el, '\0', 0); /* make line ended with NUL, no cursor shift */ in re_refresh()
292 el->el_refresh.r_newcv = el->el_refresh.r_cursor.v; in re_refresh()
296 el->el_terminal.t_size.h, el->el_refresh.r_cursor.h, in re_refresh()
297 el->el_refresh.r_cursor.v, ct_encode_string(el->el_vdisplay[0]))); in re_refresh()
299 ELRE_DEBUG(1, (__F, "updating %d lines.\r\n", el->el_refresh.r_newcv)); in re_refresh()
300 for (i = 0; i <= el->el_refresh.r_newcv; i++) { in re_refresh()
302 re_update_line(el, el->el_display[i], el->el_vdisplay[i], i); in re_refresh()
311 re__copy_and_pad(el->el_display[i], el->el_vdisplay[i], in re_refresh()
312 (size_t) el->el_terminal.t_size.h); in re_refresh()
316 el->el_refresh.r_cursor.v, el->el_refresh.r_oldcv, i)); in re_refresh()
318 if (el->el_refresh.r_oldcv > el->el_refresh.r_newcv) in re_refresh()
319 for (; i <= el->el_refresh.r_oldcv; i++) { in re_refresh()
320 terminal_move_to_line(el, i); in re_refresh()
321 terminal_move_to_char(el, 0); in re_refresh()
323 terminal_clear_EOL(el, (int) Strlen(el->el_display[i])); in re_refresh()
325 terminal_overwrite(el, "C\b", (size_t)2); in re_refresh()
327 el->el_display[i][0] = '\0'; in re_refresh()
330 el->el_refresh.r_oldcv = el->el_refresh.r_newcv; /* set for next time */ in re_refresh()
333 el->el_refresh.r_cursor.h, el->el_refresh.r_cursor.v, in re_refresh()
335 terminal_move_to_line(el, cur.v); /* go to where the cursor is */ in re_refresh()
336 terminal_move_to_char(el, cur.h); in re_refresh()
344 re_goto_bottom(EditLine *el) in re_goto_bottom() argument
347 terminal_move_to_line(el, el->el_refresh.r_oldcv); in re_goto_bottom()
348 terminal__putc(el, '\n'); in re_goto_bottom()
349 re_clear_display(el); in re_goto_bottom()
350 terminal__flush(el); in re_goto_bottom()
360 re_insert(EditLine *el __attribute__((__unused__)), in re_insert() argument
409 re_delete(EditLine *el __attribute__((__unused__)), in re_delete() argument
457 re_clear_eol(EditLine *el, int fx, int sx, int diff) in re_clear_eol() argument
473 terminal_clear_EOL(el, diff); in re_clear_eol()
501 re_update_line(EditLine *el, Char *old, Char *new, int i) in re_update_line() argument
701 re_printstr(el, "old- oe", old, oe); in re_update_line()
702 re_printstr(el, "new- ne", new, ne); in re_update_line()
703 re_printstr(el, "old-ofd", old, ofd); in re_update_line()
704 re_printstr(el, "new-nfd", new, nfd); in re_update_line()
705 re_printstr(el, "ofd-osb", ofd, osb); in re_update_line()
706 re_printstr(el, "nfd-nsb", nfd, nsb); in re_update_line()
707 re_printstr(el, "osb-ose", osb, ose); in re_update_line()
708 re_printstr(el, "nsb-nse", nsb, nse); in re_update_line()
709 re_printstr(el, "ose-ols", ose, ols); in re_update_line()
710 re_printstr(el, "nse-nls", nse, nls); in re_update_line()
711 re_printstr(el, "ols- oe", ols, oe); in re_update_line()
712 re_printstr(el, "nls- ne", nls, ne); in re_update_line()
720 terminal_move_to_line(el, i); in re_update_line()
766 ((p - old) + fx <= el->el_terminal.t_size.h)) { in re_update_line()
772 terminal_move_to_char(el, (int)(nfd - new)); in re_update_line()
784 terminal_insertwrite(el, nfd, fx); in re_update_line()
785 re_insert(el, old, (int)(ofd - old), in re_update_line()
786 el->el_terminal.t_size.h, nfd, fx); in re_update_line()
793 terminal_overwrite(el, (nfd + fx), len); in re_update_line()
798 terminal_overwrite(el, nfd, len); in re_update_line()
811 terminal_move_to_char(el, (int)(ofd - old)); in re_update_line()
824 terminal_deletechars(el, -fx); in re_update_line()
825 re_delete(el, old, (int)(ofd - old), in re_update_line()
826 el->el_terminal.t_size.h, -fx); in re_update_line()
832 terminal_overwrite(el, nfd, len); in re_update_line()
841 terminal_overwrite(el, nfd, (size_t)(nsb - nfd)); in re_update_line()
842 re_clear_eol(el, fx, sx, in re_update_line()
852 if (sx < 0 && (ose - old) + fx < el->el_terminal.t_size.h) { in re_update_line()
862 terminal_move_to_char(el, (int)((ose - old) + fx)); in re_update_line()
874 terminal_deletechars(el, -sx); in re_update_line()
879 terminal_overwrite(el, nse, (size_t)(nls - nse)); in re_update_line()
883 terminal_overwrite(el, nse, (size_t)(nls - nse)); in re_update_line()
884 re_clear_eol(el, fx, sx, in re_update_line()
895 terminal_move_to_char(el, (int)(nfd - new)); in re_update_line()
913 terminal_insertwrite(el, nfd, fx); in re_update_line()
914 re_insert(el, old, (int)(ofd - old), in re_update_line()
915 el->el_terminal.t_size.h, nfd, fx); in re_update_line()
922 terminal_overwrite(el, (nfd + fx), len); in re_update_line()
927 terminal_overwrite(el, nfd, len); in re_update_line()
937 terminal_move_to_char(el, (int)(nse - new)); in re_update_line()
944 terminal_insertwrite(el, nse, sx); in re_update_line()
950 terminal_overwrite(el, (nse + sx), in re_update_line()
954 terminal_overwrite(el, nse, (size_t)(nls - nse)); in re_update_line()
992 re_refresh_cursor(EditLine *el) in re_refresh_cursor() argument
997 if (el->el_line.cursor >= el->el_line.lastchar) { in re_refresh_cursor()
998 if (el->el_map.current == el->el_map.alt in re_refresh_cursor()
999 && el->el_line.lastchar != el->el_line.buffer) in re_refresh_cursor()
1000 el->el_line.cursor = el->el_line.lastchar - 1; in re_refresh_cursor()
1002 el->el_line.cursor = el->el_line.lastchar; in re_refresh_cursor()
1006 h = el->el_prompt.p_pos.h; in re_refresh_cursor()
1007 v = el->el_prompt.p_pos.v; in re_refresh_cursor()
1008 th = el->el_terminal.t_size.h; /* optimize for speed */ in re_refresh_cursor()
1011 for (cp = el->el_line.buffer; cp < el->el_line.cursor; cp++) { in re_refresh_cursor()
1038 if (cp < el->el_line.lastchar && (w = Width(*cp)) > 1) in re_refresh_cursor()
1045 terminal_move_to_line(el, v); in re_refresh_cursor()
1046 terminal_move_to_char(el, h); in re_refresh_cursor()
1047 terminal__flush(el); in re_refresh_cursor()
1055 re_fastputc(EditLine *el, Int c) in re_fastputc() argument
1058 while (w > 1 && el->el_cursor.h + w > el->el_terminal.t_size.h) in re_fastputc()
1059 re_fastputc(el, ' '); in re_fastputc()
1061 terminal__putc(el, c); in re_fastputc()
1062 el->el_display[el->el_cursor.v][el->el_cursor.h++] = c; in re_fastputc()
1064 el->el_display[el->el_cursor.v][el->el_cursor.h++] in re_fastputc()
1067 if (el->el_cursor.h >= el->el_terminal.t_size.h) { in re_fastputc()
1069 el->el_cursor.h = 0; in re_fastputc()
1077 if (el->el_cursor.v + 1 >= el->el_terminal.t_size.v) { in re_fastputc()
1078 int i, lins = el->el_terminal.t_size.v; in re_fastputc()
1079 Char *firstline = el->el_display[0]; in re_fastputc()
1082 el->el_display[i - 1] = el->el_display[i]; in re_fastputc()
1085 el->el_display[i - 1] = firstline; in re_fastputc()
1087 el->el_cursor.v++; in re_fastputc()
1088 el->el_refresh.r_oldcv++; in re_fastputc()
1092 terminal__putc(el, ' '); in re_fastputc()
1093 terminal__putc(el, '\b'); in re_fastputc()
1096 terminal__putc(el, '\r'); in re_fastputc()
1097 terminal__putc(el, '\n'); in re_fastputc()
1108 re_fastaddc(EditLine *el) in re_fastaddc() argument
1113 c = el->el_line.cursor[-1]; in re_fastaddc()
1115 if (c == '\t' || el->el_line.cursor != el->el_line.lastchar) { in re_fastaddc()
1116 re_refresh(el); /* too hard to handle */ in re_fastaddc()
1119 rhdiff = el->el_terminal.t_size.h - el->el_cursor.h - in re_fastaddc()
1120 el->el_rprompt.p_pos.h; in re_fastaddc()
1121 if (el->el_rprompt.p_pos.h && rhdiff < 3) { in re_fastaddc()
1122 re_refresh(el); /* clear out rprompt if less than 1 char gap */ in re_fastaddc()
1130 re_fastputc(el, c); in re_fastaddc()
1138 re_fastputc(el, visbuf[i]); in re_fastaddc()
1142 terminal__flush(el); in re_fastaddc()
1150 re_clear_display(EditLine *el) in re_clear_display() argument
1154 el->el_cursor.v = 0; in re_clear_display()
1155 el->el_cursor.h = 0; in re_clear_display()
1156 for (i = 0; i < el->el_terminal.t_size.v; i++) in re_clear_display()
1157 el->el_display[i][0] = '\0'; in re_clear_display()
1158 el->el_refresh.r_oldcv = 0; in re_clear_display()
1166 re_clear_lines(EditLine *el) in re_clear_lines() argument
1171 for (i = el->el_refresh.r_oldcv; i >= 0; i--) { in re_clear_lines()
1173 terminal_move_to_line(el, i); in re_clear_lines()
1174 terminal_move_to_char(el, 0); in re_clear_lines()
1175 terminal_clear_EOL(el, el->el_terminal.t_size.h); in re_clear_lines()
1178 terminal_move_to_line(el, el->el_refresh.r_oldcv); in re_clear_lines()
1180 terminal__putc(el, '\r'); /* go to BOL */ in re_clear_lines()
1181 terminal__putc(el, '\n'); /* go to new line */ in re_clear_lines()