Home | History | Annotate | Download | only in libedit

Lines Matching defs:EL

50 #include "el.h"
62 ed_end_of_file(EditLine *el, wint_t c __attribute__((__unused__)))
65 re_goto_bottom(el);
66 *el->el_line.lastchar = '\0';
76 ed_insert(EditLine *el, wint_t c)
78 int count = el->el_state.argument;
83 if (el->el_line.lastchar + el->el_state.argument >=
84 el->el_line.limit) {
86 if (!ch_enlargebufs(el, (size_t) count))
91 if (el->el_state.inputmode == MODE_INSERT
92 || el->el_line.cursor >= el->el_line.lastchar)
93 c_insert(el, 1);
95 *el->el_line.cursor++ = c;
96 re_fastaddc(el); /* fast refresh for one char. */
98 if (el->el_state.inputmode != MODE_REPLACE_1)
99 c_insert(el, el->el_state.argument);
101 while (count-- && el->el_line.cursor < el->el_line.lastchar)
102 *el->el_line.cursor++ = c;
103 re_refresh(el);
106 if (el->el_state.inputmode == MODE_REPLACE_1)
107 return vi_command_mode(el, 0);
119 ed_delete_prev_word(EditLine *el, wint_t c __attribute__((__unused__)))
123 if (el->el_line.cursor == el->el_line.buffer)
126 cp = c__prev_word(el->el_line.cursor, el->el_line.buffer,
127 el->el_state.argument, ce__isword);
129 for (p = cp, kp = el->el_chared.c_kill.buf; p < el->el_line.cursor; p++)
131 el->el_chared.c_kill.last = kp;
133 c_delbefore(el, (int)(el->el_line.cursor - cp));/* delete before dot */
134 el->el_line.cursor = cp;
135 if (el->el_line.cursor < el->el_line.buffer)
136 el->el_line.cursor = el->el_line.buffer; /* bounds check */
147 ed_delete_next_char(EditLine *el, wint_t c __attribute__((__unused__)))
150 #define EL el->el_line
151 (void) fprintf(el->el_errfile,
153 EL.buffer, EL.buffer, EL.cursor, EL.cursor, EL.lastchar,
154 EL.lastchar, EL.limit, EL.limit);
156 if (el->el_line.cursor == el->el_line.lastchar) {
158 if (el->el_map.type == MAP_VI) {
159 if (el->el_line.cursor == el->el_line.buffer) {
165 terminal_writec(el, c);
170 el->el_line.cursor--;
178 c_delafter(el, el->el_state.argument); /* delete after dot */
179 if (el->el_map.type == MAP_VI &&
180 el->el_line.cursor >= el->el_line.lastchar &&
181 el->el_line.cursor > el->el_line.buffer)
183 el->el_line.cursor = el->el_line.lastchar - 1;
194 ed_kill_line(EditLine *el, wint_t c __attribute__((__unused__)))
198 cp = el->el_line.cursor;
199 kp = el->el_chared.c_kill.buf;
200 while (cp < el->el_line.lastchar)
202 el->el_chared.c_kill.last = kp;
204 el->el_line.lastchar = el->el_line.cursor;
215 ed_move_to_end(EditLine *el, wint_t c __attribute__((__unused__)))
218 el->el_line.cursor = el->el_line.lastchar;
219 if (el->el_map.type == MAP_VI) {
220 if (el->el_chared.c_vcmd.action != NOP) {
221 cv_delfini(el);
225 if (el->el_line.cursor > el->el_line.buffer)
226 el->el_line.cursor--;
239 ed_move_to_beg(EditLine *el, wint_t c __attribute__((__unused__)))
242 el->el_line.cursor = el->el_line.buffer;
244 if (el->el_map.type == MAP_VI) {
246 while (iswspace(*el->el_line.cursor))
247 el->el_line.cursor++;
248 if (el->el_chared.c_vcmd.action != NOP) {
249 cv_delfini(el);
262 ed_transpose_chars(EditLine *el, wint_t c)
265 if (el->el_line.cursor < el->el_line.lastchar) {
266 if (el->el_line.lastchar <= &el->el_line.buffer[1])
269 el->el_line.cursor++;
271 if (el->el_line.cursor > &el->el_line.buffer[1]) {
273 c = el->el_line.cursor[-2];
274 el->el_line.cursor[-2] = el->el_line.cursor[-1];
275 el->el_line.cursor[-1] = c;
288 ed_next_char(EditLine *el, wint_t c __attribute__((__unused__)))
290 wchar_t *lim = el->el_line.lastchar;
292 if (el->el_line.cursor >= lim ||
293 (el->el_line.cursor == lim - 1 &&
294 el->el_map.type == MAP_VI &&
295 el->el_chared.c_vcmd.action == NOP))
298 el->el_line.cursor += el->el_state.argument;
299 if (el->el_line.cursor > lim)
300 el->el_line.cursor = lim;
302 if (el->el_map.type == MAP_VI)
303 if (el->el_chared.c_vcmd.action != NOP) {
304 cv_delfini(el);
317 ed_prev_word(EditLine *el, wint_t c __attribute__((__unused__)))
320 if (el->el_line.cursor == el->el_line.buffer)
323 el->el_line.cursor = c__prev_word(el->el_line.cursor,
324 el->el_line.buffer,
325 el->el_state.argument,
328 if (el->el_map.type == MAP_VI)
329 if (el->el_chared.c_vcmd.action != NOP) {
330 cv_delfini(el);
343 ed_prev_char(EditLine *el, wint_t c __attribute__((__unused__)))
346 if (el->el_line.cursor > el->el_line.buffer) {
347 el->el_line.cursor -= el->el_state.argument;
348 if (el->el_line.cursor < el->el_line.buffer)
349 el->el_line.cursor = el->el_line.buffer;
351 if (el->el_map.type == MAP_VI)
352 if (el->el_chared.c_vcmd.action != NOP) {
353 cv_delfini(el);
368 ed_quoted_insert(EditLine *el, wint_t c __attribute__((__unused__)))
373 tty_quotemode(el);
374 num = el_wgetc(el, &ch);
375 tty_noquotemode(el);
377 return ed_insert(el, ch);
379 return ed_end_of_file(el, 0);
387 ed_digit(EditLine *el, wint_t c)
393 if (el->el_state.doingarg) {
395 if (el->el_state.lastcmd == EM_UNIVERSAL_ARGUMENT)
396 el->el_state.argument = c - '0';
398 if (el->el_state.argument > 1000000)
400 el->el_state.argument =
401 (el->el_state.argument * 10) + (c - '0');
406 return ed_insert(el, c);
415 ed_argument_digit(EditLine *el, wint_t c)
421 if (el->el_state.doingarg) {
422 if (el->el_state.argument > 1000000)
424 el->el_state.argument = (el->el_state.argument * 10) +
427 el->el_state.argument = c - '0';
428 el->el_state.doingarg = 1;
440 ed_unassigned(EditLine *el __attribute__((__unused__)),
454 ed_ignore(EditLine *el __attribute__((__unused__)),
468 ed_newline(EditLine *el, wint_t c __attribute__((__unused__)))
471 re_goto_bottom(el);
472 *el->el_line.lastchar++ = '\n';
473 *el->el_line.lastchar = '\0';
484 ed_delete_prev_char(EditLine *el, wint_t c __attribute__((__unused__)))
487 if (el->el_line.cursor <= el->el_line.buffer)
490 c_delbefore(el, el->el_state.argument);
491 el->el_line.cursor -= el->el_state.argument;
492 if (el->el_line.cursor < el->el_line.buffer)
493 el->el_line.cursor = el->el_line.buffer;
504 ed_clear_screen(EditLine *el, wint_t c __attribute__((__unused__)))
507 terminal_clear_screen(el); /* clear the whole real screen */
508 re_clear_display(el); /* reset everything */
519 ed_redisplay(EditLine *el __attribute__((__unused__)),
533 ed_start_over(EditLine *el, wint_t c __attribute__((__unused__)))
536 ch_reset(el);
547 ed_sequence_lead_in(EditLine *el __attribute__((__unused__)),
561 ed_prev_history(EditLine *el, wint_t c __attribute__((__unused__)))
564 int sv_event = el->el_history.eventno;
566 el->el_chared.c_undo.len = -1;
567 *el->el_line.lastchar = '\0'; /* just in case */
569 if (el->el_history.eventno == 0) { /* save the current buffer
571 (void) wcsncpy(el->el_history.buf, el->el_line.buffer,
573 el->el_history.last = el->el_history.buf +
574 (el->el_line.lastchar - el->el_line.buffer);
576 el->el_history.eventno += el->el_state.argument;
578 if (hist_get(el) == CC_ERROR) {
579 if (el->el_map.type == MAP_VI) {
580 el->el_history.eventno = sv_event;
583 /* el->el_history.eventno was fixed by first call */
584 (void) hist_get(el);
598 ed_next_history(EditLine *el, wint_t c __attribute__((__unused__)))
602 el->el_chared.c_undo.len = -1;
603 *el->el_line.lastchar = '\0'; /* just in case */
605 el->el_history.eventno -= el->el_state.argument;
607 if (el->el_history.eventno < 0) {
608 el->el_history.eventno = 0;
611 rval = hist_get(el);
625 ed_search_prev_history(EditLine *el, wint_t c __attribute__((__unused__)))
631 el->el_chared.c_vcmd.action = NOP;
632 el->el_chared.c_undo.len = -1;
633 *el->el_line.lastchar = '\0'; /* just in case */
634 if (el->el_history.eventno < 0) {
636 (void) fprintf(el->el_errfile,
639 el->el_history.eventno = 0;
642 if (el->el_history.eventno == 0) {
643 (void) wcsncpy(el->el_history.buf, el->el_line.buffer,
645 el->el_history.last = el->el_history.buf +
646 (el->el_line.lastchar - el->el_line.buffer);
648 if (el->el_history.ref == NULL)
651 hp = HIST_FIRST(el);
655 c_setpat(el); /* Set search pattern !! */
657 for (h = 1; h <= el->el_history.eventno; h++)
658 hp = HIST_NEXT(el);
662 (void) fprintf(el->el_errfile, "Comparing with \"%ls\"\n", hp);
664 if ((wcsncmp(hp, el->el_line.buffer, (size_t)
665 (el->el_line.lastchar - el->el_line.buffer)) ||
666 hp[el->el_line.lastchar - el->el_line.buffer]) &&
667 c_hmatch(el, hp)) {
672 hp = HIST_NEXT(el);
677 (void) fprintf(el->el_errfile, "not found\n");
681 el->el_history.eventno = h;
683 return hist_get(el);
693 ed_search_next_history(EditLine *el, wint_t c __attribute__((__unused__)))
699 el->el_chared.c_vcmd.action = NOP;
700 el->el_chared.c_undo.len = -1;
701 *el->el_line.lastchar = '\0'; /* just in case */
703 if (el->el_history.eventno == 0)
706 if (el->el_history.ref == NULL)
709 hp = HIST_FIRST(el);
713 c_setpat(el); /* Set search pattern !! */
715 for (h = 1; h < el
717 (void) fprintf(el->el_errfile, "Comparing with \"%ls\"\n", hp);
719 if ((wcsncmp(hp, el->el_line.buffer, (size_t)
720 (el->el_line.lastchar - el->el_line.buffer)) ||
721 hp[el->el_line.lastchar - el->el_line.buffer]) &&
722 c_hmatch(el, hp))
724 hp = HIST_NEXT(el);
728 if (!c_hmatch(el, el->el_history.buf)) {
730 (void) fprintf(el->el_errfile, "not found\n");
735 el->el_history.eventno = found;
737 return hist_get(el);
747 ed_prev_line(EditLine *el, wint_t c __attribute__((__unused__)))
750 int nchars = c_hpos(el);
755 if (*(ptr = el->el_line.cursor) == '\n')
758 for (; ptr >= el->el_line.buffer; ptr--)
759 if (*ptr == '\n' && --el->el_state.argument <= 0)
762 if (el->el_state.argument > 0)
768 for (ptr--; ptr >= el->el_line.buffer && *ptr != '\n'; ptr--)
775 nchars-- > 0 && ptr < el->el_line.lastchar && *ptr != '\n';
779 el->el_line.cursor = ptr;
790 ed_next_line(EditLine *el, wint_t c __attribute__((__unused__)))
793 int nchars = c_hpos(el);
798 for (ptr = el->el_line.cursor; ptr < el->el_line.lastchar; ptr++)
799 if (*ptr == '\n' && --el->el_state.argument <= 0)
802 if (el->el_state.argument > 0)
809 nchars-- > 0 && ptr < el->el_line.lastchar && *ptr != '\n';
813 el->el_line.cursor = ptr;
824 ed_command(EditLine *el, wint_t c __attribute__((__unused__)))
829 tmplen = c_gets(el, tmpbuf, L"\n: ");
830 terminal__putc(el, '\n');
832 if (tmplen < 0 || (tmpbuf[tmplen] = 0, parse_line(el, tmpbuf)) == -1)
833 terminal_beep(el);
835 el->el_map.current = el->el_map.key;
836 re_clear_display(el);