• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.10/lukemftp-14/tnftp/libedit/

Lines Matching refs:el

42 #include "el.h"
50 ed_end_of_file(EditLine *el, int c __attribute__((__unused__)))
53 re_goto_bottom(el);
54 *el->el_line.lastchar = '\0';
64 ed_insert(EditLine *el, int c)
66 int count = el->el_state.argument;
71 if (el->el_line.lastchar + el->el_state.argument >=
72 el->el_line.limit) {
74 if (!ch_enlargebufs(el, (size_t) count))
79 if (el->el_state.inputmode == MODE_INSERT
80 || el->el_line.cursor >= el->el_line.lastchar)
81 c_insert(el, 1);
83 *el->el_line.cursor++ = c;
84 re_fastaddc(el); /* fast refresh for one char. */
86 if (el->el_state.inputmode != MODE_REPLACE_1)
87 c_insert(el, el->el_state.argument);
89 while (count-- && el->el_line.cursor < el->el_line.lastchar)
90 *el->el_line.cursor++ = c;
91 re_refresh(el);
94 if (el->el_state.inputmode == MODE_REPLACE_1)
95 return vi_command_mode(el, 0);
107 ed_delete_prev_word(EditLine *el, int c __attribute__((__unused__)))
111 if (el->el_line.cursor == el->el_line.buffer)
114 cp = c__prev_word(el->el_line.cursor, el->el_line.buffer,
115 el->el_state.argument, ce__isword);
117 for (p = cp, kp = el->el_chared.c_kill.buf; p < el->el_line.cursor; p++)
119 el->el_chared.c_kill.last = kp;
121 c_delbefore(el, el->el_line.cursor - cp); /* delete before dot */
122 el->el_line.cursor = cp;
123 if (el->el_line.cursor < el->el_line.buffer)
124 el->el_line.cursor = el->el_line.buffer; /* bounds check */
135 ed_delete_next_char(EditLine *el, int c __attribute__((__unused__)))
138 #define EL el->el_line
139 (void) fprintf(el->el_errlfile,
144 if (el->el_line.cursor == el->el_line.lastchar) {
146 if (el->el_map.type == MAP_VI) {
147 if (el->el_line.cursor == el->el_line.buffer) {
152 term_overwrite(el, STReof, 4);
159 el->el_line.cursor--;
165 if (el->el_line.cursor != el->el_line.buffer)
166 el->el_line.cursor--;
171 c_delafter(el, el->el_state.argument); /* delete after dot */
172 if (el->el_line.cursor >= el->el_line.lastchar &&
173 el->el_line.cursor > el->el_line.buffer)
175 el->el_line.cursor = el->el_line.lastchar - 1;
186 ed_kill_line(EditLine *el, int c __attribute__((__unused__)))
190 cp = el->el_line.cursor;
191 kp = el->el_chared.c_kill.buf;
192 while (cp < el->el_line.lastchar)
194 el->el_chared.c_kill.last = kp;
196 el->el_line.lastchar = el->el_line.cursor;
207 ed_move_to_end(EditLine *el, int c __attribute__((__unused__)))
210 el->el_line.cursor = el->el_line.lastchar;
211 if (el->el_map.type == MAP_VI) {
213 el->el_line.cursor--;
215 if (el->el_chared.c_vcmd.action != NOP) {
216 cv_delfini(el);
230 ed_move_to_beg(EditLine *el, int c __attribute__((__unused__)))
233 el->el_line.cursor = el->el_line.buffer;
235 if (el->el_map.type == MAP_VI) {
237 while (isspace((unsigned char) *el->el_line.cursor))
238 el->el_line.cursor++;
239 if (el->el_chared.c_vcmd.action != NOP) {
240 cv_delfini(el);
253 ed_transpose_chars(EditLine *el, int c)
256 if (el->el_line.cursor < el->el_line.lastchar) {
257 if (el->el_line.lastchar <= &el->el_line.buffer[1])
260 el->el_line.cursor++;
262 if (el->el_line.cursor > &el->el_line.buffer[1]) {
264 c = el->el_line.cursor[-2];
265 el->el_line.cursor[-2] = el->el_line.cursor[-1];
266 el->el_line.cursor[-1] = c;
279 ed_next_char(EditLine *el, int c __attribute__((__unused__)))
281 char *lim = el->el_line.lastchar;
283 if (el->el_line.cursor >= lim ||
284 (el->el_line.cursor == lim - 1 &&
285 el->el_map.type == MAP_VI &&
286 el->el_chared.c_vcmd.action == NOP))
289 el->el_line.cursor += el->el_state.argument;
290 if (el->el_line.cursor > lim)
291 el->el_line.cursor = lim;
293 if (el->el_map.type == MAP_VI)
294 if (el->el_chared.c_vcmd.action != NOP) {
295 cv_delfini(el);
308 ed_prev_word(EditLine *el, int c __attribute__((__unused__)))
311 if (el->el_line.cursor == el->el_line.buffer)
314 el->el_line.cursor = c__prev_word(el->el_line.cursor,
315 el->el_line.buffer,
316 el->el_state.argument,
319 if (el->el_map.type == MAP_VI)
320 if (el->el_chared.c_vcmd.action != NOP) {
321 cv_delfini(el);
334 ed_prev_char(EditLine *el, int c __attribute__((__unused__)))
337 if (el->el_line.cursor > el->el_line.buffer) {
338 el->el_line.cursor -= el->el_state.argument;
339 if (el->el_line.cursor < el->el_line.buffer)
340 el->el_line.cursor = el->el_line.buffer;
342 if (el->el_map.type == MAP_VI)
343 if (el->el_chared.c_vcmd.action != NOP) {
344 cv_delfini(el);
358 ed_quoted_insert(EditLine *el, int c)
363 tty_quotemode(el);
364 num = el_getc(el, &tc);
366 tty_noquotemode(el);
368 return (ed_insert(el, c));
370 return (ed_end_of_file(el, 0));
378 ed_digit(EditLine *el, int c)
384 if (el->el_state.doingarg) {
386 if (el->el_state.lastcmd == EM_UNIVERSAL_ARGUMENT)
387 el->el_state.argument = c - '0';
389 if (el->el_state.argument > 1000000)
391 el->el_state.argument =
392 (el->el_state.argument * 10) + (c - '0');
397 return ed_insert(el, c);
406 ed_argument_digit(EditLine *el, int c)
412 if (el->el_state.doingarg) {
413 if (el->el_state.argument > 1000000)
415 el->el_state.argument = (el->el_state.argument * 10) +
418 el->el_state.argument = c - '0';
419 el->el_state.doingarg = 1;
431 ed_unassigned(EditLine *el, int c __attribute__((__unused__)))
448 ed_tty_sigint(EditLine *el __attribute__((__unused__)),
462 ed_tty_dsusp(EditLine *el __attribute__((__unused__)),
476 ed_tty_flush_output(EditLine *el __attribute__((__unused__)),
490 ed_tty_sigquit(EditLine *el __attribute__((__unused__)),
504 ed_tty_sigtstp(EditLine *el __attribute__((__unused__)),
518 ed_tty_stop_output(EditLine *el __attribute__((__unused__)),
532 ed_tty_start_output(EditLine *el __attribute__((__unused__)),
546 ed_newline(EditLine *el, int c __attribute__((__unused__)))
549 re_goto_bottom(el);
550 *el->el_line.lastchar++ = '\n';
551 *el->el_line.lastchar = '\0';
562 ed_delete_prev_char(EditLine *el, int c __attribute__((__unused__)))
565 if (el->el_line.cursor <= el->el_line.buffer)
568 c_delbefore(el, el->el_state.argument);
569 el->el_line.cursor -= el->el_state.argument;
570 if (el->el_line.cursor < el->el_line.buffer)
571 el->el_line.cursor = el->el_line.buffer;
582 ed_clear_screen(EditLine *el, int c __attribute__((__unused__)))
585 term_clear_screen(el); /* clear the whole real screen */
586 re_clear_display(el); /* reset everything */
597 ed_redisplay(EditLine *el __attribute__((__unused__)),
611 ed_start_over(EditLine *el, int c __attribute__((__unused__)))
614 ch_reset(el);
625 ed_sequence_lead_in(EditLine *el __attribute__((__unused__)),
639 ed_prev_history(EditLine *el, int c __attribute__((__unused__)))
642 int sv_event = el->el_history.eventno;
644 el->el_chared.c_undo.len = -1;
645 *el->el_line.lastchar = '\0'; /* just in case */
647 if (el->el_history.eventno == 0) { /* save the current buffer
649 (void) strncpy(el->el_history.buf, el->el_line.buffer,
651 el->el_history.last = el->el_history.buf +
652 (el->el_line.lastchar - el->el_line.buffer);
654 el->el_history.eventno += el->el_state.argument;
656 if (hist_get(el) == CC_ERROR) {
657 if (el->el_map.type == MAP_VI) {
658 el->el_history.eventno = sv_event;
662 /* el->el_history.eventno was fixed by first call */
663 (void) hist_get(el);
677 ed_next_history(EditLine *el, int c __attribute__((__unused__)))
681 el->el_chared.c_undo.len = -1;
682 *el->el_line.lastchar = '\0'; /* just in case */
684 el->el_history.eventno -= el->el_state.argument;
686 if (el->el_history.eventno < 0) {
687 el->el_history.eventno = 0;
690 rval = hist_get(el);
704 ed_search_prev_history(EditLine *el, int c __attribute__((__unused__)))
710 el->el_chared.c_vcmd.action = NOP;
711 el->el_chared.c_undo.len = -1;
712 *el->el_line.lastchar = '\0'; /* just in case */
713 if (el->el_history.eventno < 0) {
715 (void) fprintf(el->el_errfile,
718 el->el_history.eventno = 0;
721 if (el->el_history.eventno == 0) {
722 (void) strncpy(el->el_history.buf, el->el_line.buffer,
724 el->el_history.last = el->el_history.buf +
725 (el->el_line.lastchar - el->el_line.buffer);
727 if (el->el_history.ref == NULL)
730 hp = HIST_FIRST(el);
734 c_setpat(el); /* Set search pattern !! */
736 for (h = 1; h <= el->el_history.eventno; h++)
737 hp = HIST_NEXT(el);
741 (void) fprintf(el->el_errfile, "Comparing with \"%s\"\n", hp);
743 if ((strncmp(hp, el->el_line.buffer, (size_t)
744 (el->el_line.lastchar - el->el_line.buffer)) ||
745 hp[el->el_line.lastchar - el->el_line.buffer]) &&
746 c_hmatch(el, hp)) {
751 hp = HIST_NEXT(el);
756 (void) fprintf(el->el_errfile, "not found\n");
760 el->el_history.eventno = h;
762 return (hist_get(el));
772 ed_search_next_history(EditLine *el, int c __attribute__((__unused__)))
778 el->el_chared.c_vcmd.action = NOP;
779 el->el_chared.c_undo.len = -1;
780 *el->el_line.lastchar = '\0'; /* just in case */
782 if (el->el_history.eventno == 0)
785 if (el->el_history.ref == NULL)
788 hp = HIST_FIRST(el);
792 c_setpat(el); /* Set search pattern !! */
794 for (h = 1; h < el->el_history.eventno && hp; h++) {
796 (void) fprintf(el->el_errfile, "Comparing with \"%s\"\n", hp);
798 if ((strncmp(hp, el->el_line.buffer, (size_t)
799 (el->el_line.lastchar - el->el_line.buffer)) ||
800 hp[el->el_line.lastchar - el->el_line.buffer]) &&
801 c_hmatch(el, hp))
803 hp = HIST_NEXT(el);
807 if (!c_hmatch(el, el->el_history.buf)) {
809 (void) fprintf(el->el_errfile, "not found\n");
814 el->el_history.eventno = found;
816 return (hist_get(el));
826 ed_prev_line(EditLine *el, int c __attribute__((__unused__)))
829 int nchars = c_hpos(el);
834 if (*(ptr = el->el_line.cursor) == '\n')
837 for (; ptr >= el->el_line.buffer; ptr--)
838 if (*ptr == '\n' && --el->el_state.argument <= 0)
841 if (el->el_state.argument > 0)
847 for (ptr--; ptr >= el->el_line.buffer && *ptr != '\n'; ptr--)
854 nchars-- > 0 && ptr < el->el_line.lastchar && *ptr != '\n';
858 el->el_line.cursor = ptr;
869 ed_next_line(EditLine *el, int c __attribute__((__unused__)))
872 int nchars = c_hpos(el);
877 for (ptr = el->el_line.cursor; ptr < el->el_line.lastchar; ptr++)
878 if (*ptr == '\n' && --el->el_state.argument <= 0)
881 if (el->el_state.argument > 0)
888 nchars-- > 0 && ptr < el->el_line.lastchar && *ptr != '\n';
892 el->el_line.cursor = ptr;
903 ed_command(EditLine *el, int c __attribute__((__unused__)))
908 tmplen = c_gets(el, tmpbuf, "\n: ");
911 if (tmplen < 0 || (tmpbuf[tmplen] = 0, parse_line(el, tmpbuf)) == -1)
912 term_beep(el);
914 el->el_map.current = el->el_map.key;
915 re_clear_display(el);