Home | History | Annotate | Download | only in src

Lines Matching refs:EL

47 #include "el.h"
55 ed_end_of_file(EditLine *el, Int c __attribute__((__unused__)))
58 re_goto_bottom(el);
59 *el->el_line.lastchar = '\0';
69 ed_insert(EditLine *el, Int c)
71 int count = el->el_state.argument;
76 if (el->el_line.lastchar + el->el_state.argument >=
77 el->el_line.limit) {
79 if (!ch_enlargebufs(el, (size_t) count))
84 if (el->el_state.inputmode == MODE_INSERT
85 || el->el_line.cursor >= el->el_line.lastchar)
86 c_insert(el, 1);
88 *el->el_line.cursor++ = c;
89 re_fastaddc(el); /* fast refresh for one char. */
91 if (el->el_state.inputmode != MODE_REPLACE_1)
92 c_insert(el, el->el_state.argument);
94 while (count-- && el->el_line.cursor < el->el_line.lastchar)
95 *el->el_line.cursor++ = c;
96 re_refresh(el);
99 if (el->el_state.inputmode == MODE_REPLACE_1)
100 return vi_command_mode(el, 0);
112 ed_delete_prev_word(EditLine *el, Int c __attribute__((__unused__)))
116 if (el->el_line.cursor == el->el_line.buffer)
119 cp = c__prev_word(el->el_line.cursor, el->el_line.buffer,
120 el->el_state.argument, ce__isword);
122 for (p = cp, kp = el->el_chared.c_kill.buf; p < el->el_line.cursor; p++)
124 el->el_chared.c_kill.last = kp;
126 c_delbefore(el, (int)(el->el_line.cursor - cp));/* delete before dot */
127 el->el_line.cursor = cp;
128 if (el->el_line.cursor < el->el_line.buffer)
129 el->el_line.cursor = el->el_line.buffer; /* bounds check */
140 ed_delete_next_char(EditLine *el, Int c __attribute__((__unused__)))
143 #define EL el->el_line
144 (void) fprintf(el->el_errlfile,
146 EL.buffer, EL.buffer, EL.cursor, EL.cursor, EL.lastchar,
147 EL.lastchar, EL.limit, EL.limit);
149 if (el->el_line.cursor == el->el_line.lastchar) {
151 if (el->el_map.type == MAP_VI) {
152 if (el->el_line.cursor == el->el_line.buffer) {
158 terminal_writec(el, c);
163 el->el_line.cursor--;
171 c_delafter(el, el->el_state.argument); /* delete after dot */
172 if (el->el_map.type == MAP_VI &&
173 el->el_line.cursor >= el->el_line.lastchar &&
174 el->el_line.cursor > el->el_line.buffer)
176 el->el_line.cursor = el->el_line.lastchar - 1;
187 ed_kill_line(EditLine *el, Int c __attribute__((__unused__)))
191 cp = el->el_line.cursor;
192 kp = el->el_chared.c_kill.buf;
193 while (cp < el->el_line.lastchar)
195 el->el_chared.c_kill.last = kp;
197 el->el_line.lastchar = el->el_line.cursor;
208 ed_move_to_end(EditLine *el, Int c __attribute__((__unused__)))
211 el->el_line.cursor = el->el_line.lastchar;
212 if (el->el_map.type == MAP_VI) {
213 if (el->el_chared.c_vcmd.action != NOP) {
214 cv_delfini(el);
218 el->el_line.cursor--;
231 ed_move_to_beg(EditLine *el, Int c __attribute__((__unused__)))
234 el->el_line.cursor = el->el_line.buffer;
236 if (el->el_map.type == MAP_VI) {
238 while (Isspace(*el->el_line.cursor))
239 el->el_line.cursor++;
240 if (el->el_chared.c_vcmd.action != NOP) {
241 cv_delfini(el);
254 ed_transpose_chars(EditLine *el, Int c)
257 if (el->el_line.cursor < el->el_line.lastchar) {
258 if (el->el_line.lastchar <= &el->el_line.buffer[1])
261 el->el_line.cursor++;
263 if (el->el_line.cursor > &el->el_line.buffer[1]) {
265 c = el->el_line.cursor[-2];
266 el->el_line.cursor[-2] = el->el_line.cursor[-1];
267 el->el_line.cursor[-1] = c;
280 ed_next_char(EditLine *el, Int c __attribute__((__unused__)))
282 Char *lim = el->el_line.lastchar;
284 if (el->el_line.cursor >= lim ||
285 (el->el_line.cursor == lim - 1 &&
286 el->el_map.type == MAP_VI &&
287 el->el_chared.c_vcmd.action == NOP))
290 el->el_line.cursor += el->el_state.argument;
291 if (el->el_line.cursor > lim)
292 el->el_line.cursor = lim;
294 if (el->el_map.type == MAP_VI)
295 if (el->el_chared.c_vcmd.action != NOP) {
296 cv_delfini(el);
309 ed_prev_word(EditLine *el, Int c __attribute__((__unused__)))
312 if (el->el_line.cursor == el->el_line.buffer)
315 el->el_line.cursor = c__prev_word(el->el_line.cursor,
316 el->el_line.buffer,
317 el->el_state.argument,
320 if (el->el_map.type == MAP_VI)
321 if (el->el_chared.c_vcmd.action != NOP) {
322 cv_delfini(el);
335 ed_prev_char(EditLine *el, Int c __attribute__((__unused__)))
338 if (el->el_line.cursor > el->el_line.buffer) {
339 el->el_line.cursor -= el->el_state.argument;
340 if (el->el_line.cursor < el->el_line.buffer)
341 el->el_line.cursor = el->el_line.buffer;
343 if (el->el_map.type == MAP_VI)
344 if (el->el_chared.c_vcmd.action != NOP) {
345 cv_delfini(el);
359 ed_quoted_insert(EditLine *el, Int c)
364 tty_quotemode(el);
365 num = FUN(el,getc)(el, &tc);
367 tty_noquotemode(el);
369 return ed_insert(el, c);
371 return ed_end_of_file(el, 0);
379 ed_digit(EditLine *el, Int c)
385 if (el->el_state.doingarg) {
387 if (el->el_state.lastcmd == EM_UNIVERSAL_ARGUMENT)
388 el->el_state.argument = c - '0';
390 if (el->el_state.argument > 1000000)
392 el->el_state.argument =
393 (el->el_state.argument * 10) + (c - '0');
398 return ed_insert(el, c);
407 ed_argument_digit(EditLine *el, Int c)
413 if (el->el_state.doingarg) {
414 if (el->el_state.argument > 1000000)
416 el->el_state.argument = (el->el_state.argument * 10) +
419 el->el_state.argument = c - '0';
420 el->el_state.doingarg = 1;
432 ed_unassigned(EditLine *el __attribute__((__unused__)),
450 ed_tty_sigint(EditLine *el __attribute__((__unused__)),
464 ed_tty_dsusp(EditLine *el __attribute__((__unused__)),
478 ed_tty_flush_output(EditLine *el __attribute__((__unused__)),
492 ed_tty_sigquit(EditLine *el __attribute__((__unused__)),
506 ed_tty_sigtstp(EditLine *el __attribute__((__unused__)),
520 ed_tty_stop_output(EditLine *el __attribute__((__unused__)),
534 ed_tty_start_output(EditLine *el __attribute__((__unused__)),
548 ed_newline(EditLine *el, Int c __attribute__((__unused__)))
551 re_goto_bottom(el);
552 *el->el_line.lastchar++ = '\n';
553 *el->el_line.lastchar = '\0';
564 ed_delete_prev_char(EditLine *el, Int c __attribute__((__unused__)))
567 if (el->el_line.cursor <= el->el_line.buffer)
570 c_delbefore(el, el->el_state.argument);
571 el->el_line.cursor -= el->el_state.argument;
572 if (el->el_line.cursor < el->el_line.buffer)
573 el->el_line.cursor = el->el_line.buffer;
584 ed_clear_screen(EditLine *el, Int c __attribute__((__unused__)))
587 terminal_clear_screen(el); /* clear the whole real screen */
588 re_clear_display(el); /* reset everything */
599 ed_redisplay(EditLine *el __attribute__((__unused__)),
613 ed_start_over(EditLine *el, Int c __attribute__((__unused__)))
616 ch_reset(el, 0);
627 ed_sequence_lead_in(EditLine *el __attribute__((__unused__)),
641 ed_prev_history(EditLine *el, Int c __attribute__((__unused__)))
644 int sv_event = el->el_history.eventno;
646 el->el_chared.c_undo.len = -1;
647 *el->el_line.lastchar = '\0'; /* just in case */
649 if (el->el_history.eventno == 0) { /* save the current buffer
651 (void) Strncpy(el->el_history.buf, el->el_line.buffer,
653 el->el_history.last = el->el_history.buf +
654 (el->el_line.lastchar - el->el_line.buffer);
656 el->el_history.eventno += el->el_state.argument;
658 if (hist_get(el) == CC_ERROR) {
659 if (el->el_map.type == MAP_VI) {
660 el->el_history.eventno = sv_event;
664 /* el->el_history.eventno was fixed by first call */
665 (void) hist_get(el);
679 ed_next_history(EditLine *el, Int c __attribute__((__unused__)))
683 el->el_chared.c_undo.len = -1;
684 *el->el_line.lastchar = '\0'; /* just in case */
686 el->el_history.eventno -= el->el_state.argument;
688 if (el->el_history.eventno < 0) {
689 el->el_history.eventno = 0;
692 rval = hist_get(el);
706 ed_search_prev_history(EditLine *el, Int c __attribute__((__unused__)))
712 el->el_chared.c_vcmd.action = NOP;
713 el->el_chared.c_undo.len = -1;
714 *el->el_line.lastchar = '\0'; /* just in case */
715 if (el->el_history.eventno < 0) {
717 (void) fprintf(el->el_errfile,
720 el->el_history.eventno = 0;
723 if (el->el_history.eventno == 0) {
724 (void) Strncpy(el->el_history.buf, el->el_line.buffer,
726 el->el_history.last = el->el_history.buf +
727 (el->el_line.lastchar - el->el_line.buffer);
729 if (el->el_history.ref == NULL)
732 hp = HIST_FIRST(el);
736 c_setpat(el); /* Set search pattern !! */
738 for (h = 1; h <= el->el_history.eventno; h++)
739 hp = HIST_NEXT(el);
743 (void) fprintf(el->el_errfile, "Comparing with \"%s\"\n", hp);
745 if ((Strncmp(hp, el->el_line.buffer, (size_t)
746 (el->el_line.lastchar - el->el_line.buffer)) ||
747 hp[el->el_line.lastchar - el
748 c_hmatch(el, hp)) {
753 hp = HIST_NEXT(el);
758 (void) fprintf(el->el_errfile, "not found\n");
762 el->el_history.eventno = h;
764 return hist_get(el);
774 ed_search_next_history(EditLine *el, Int c __attribute__((__unused__)))
780 el->el_chared.c_vcmd.action = NOP;
781 el->el_chared.c_undo.len = -1;
782 *el->el_line.lastchar = '\0'; /* just in case */
784 if (el->el_history.eventno == 0)
787 if (el->el_history.ref == NULL)
790 hp = HIST_FIRST(el);
794 c_setpat(el); /* Set search pattern !! */
796 for (h = 1; h < el->el_history.eventno && hp; h++) {
798 (void) fprintf(el->el_errfile, "Comparing with \"%s\"\n", hp);
800 if ((Strncmp(hp, el->el_line.buffer, (size_t)
801 (el->el_line.lastchar - el->el_line.buffer)) ||
802 hp[el->el_line.lastchar - el->el_line.buffer]) &&
803 c_hmatch(el, hp))
805 hp = HIST_NEXT(el);
809 if (!c_hmatch(el, el->el_history.buf)) {
811 (void) fprintf(el->el_errfile, "not found\n");
816 el->el_history.eventno = found;
818 return hist_get(el);
828 ed_prev_line(EditLine *el, Int c __attribute__((__unused__)))
831 int nchars = c_hpos(el);
836 if (*(ptr = el->el_line.cursor) == '\n')
839 for (; ptr >= el->el_line.buffer; ptr--)
840 if (*ptr == '\n' && --el->el_state.argument <= 0)
843 if (el->el_state.argument > 0)
849 for (ptr--; ptr >= el->el_line.buffer && *ptr != '\n'; ptr--)
856 nchars-- > 0 && ptr < el->el_line.lastchar && *ptr != '\n';
860 el->el_line.cursor = ptr;
871 ed_next_line(EditLine *el, Int c __attribute__((__unused__)))
874 int nchars = c_hpos(el);
879 for (ptr = el->el_line.cursor; ptr < el->el_line.lastchar; ptr++)
880 if (*ptr == '\n' && --el->el_state.argument <= 0)
883 if (el->el_state.argument > 0)
890 nchars-- > 0 && ptr < el->el_line.lastchar && *ptr != '\n';
894 el->el_line.cursor = ptr;
905 ed_command(EditLine *el, Int c __attribute__((__unused__)))
910 tmplen = c_gets(el, tmpbuf, STR("\n: "));
911 terminal__putc(el, '\n');
913 if (tmplen < 0 || (tmpbuf[tmplen] = 0, parse_line(el, tmpbuf)) == -1)
914 terminal_beep(el);
916 el->el_map.current = el->el_map.key;
917 re_clear_display(el);