Lines Matching refs:el
67 cv_action(EditLine *el, wint_t c) in cv_action() argument
70 if (el->el_chared.c_vcmd.action != NOP) { in cv_action()
72 if (c != (wint_t)el->el_chared.c_vcmd.action) in cv_action()
76 cv_undo(el); in cv_action()
77 cv_yank(el, el->el_line.buffer, in cv_action()
78 (int)(el->el_line.lastchar - el->el_line.buffer)); in cv_action()
79 el->el_chared.c_vcmd.action = NOP; in cv_action()
80 el->el_chared.c_vcmd.pos = 0; in cv_action()
82 el->el_line.lastchar = el->el_line.buffer; in cv_action()
83 el->el_line.cursor = el->el_line.buffer; in cv_action()
86 el->el_map.current = el->el_map.key; in cv_action()
90 el->el_chared.c_vcmd.pos = el->el_line.cursor; in cv_action()
91 el->el_chared.c_vcmd.action = c; in cv_action()
99 cv_paste(EditLine *el, wint_t c) in cv_paste() argument
101 c_kill_t *k = &el->el_chared.c_kill; in cv_paste()
107 (void) fprintf(el->el_errfile, "Paste: \"%.*ls\"\n", (int)len, in cv_paste()
111 cv_undo(el); in cv_paste()
113 if (!c && el->el_line.cursor < el->el_line.lastchar) in cv_paste()
114 el->el_line.cursor++; in cv_paste()
116 c_insert(el, (int)len); in cv_paste()
117 if (el->el_line.cursor + len > el->el_line.lastchar) in cv_paste()
119 (void) memcpy(el->el_line.cursor, k->buf, len * in cv_paste()
120 sizeof(*el->el_line.cursor)); in cv_paste()
132 vi_paste_next(EditLine *el, wint_t c __attribute__((__unused__))) in vi_paste_next() argument
135 return cv_paste(el, 0); in vi_paste_next()
145 vi_paste_prev(EditLine *el, wint_t c __attribute__((__unused__))) in vi_paste_prev() argument
148 return cv_paste(el, 1); in vi_paste_prev()
158 vi_prev_big_word(EditLine *el, wint_t c __attribute__((__unused__))) in vi_prev_big_word() argument
161 if (el->el_line.cursor == el->el_line.buffer) in vi_prev_big_word()
164 el->el_line.cursor = cv_prev_word(el->el_line.cursor, in vi_prev_big_word()
165 el->el_line.buffer, in vi_prev_big_word()
166 el->el_state.argument, in vi_prev_big_word()
169 if (el->el_chared.c_vcmd.action != NOP) { in vi_prev_big_word()
170 cv_delfini(el); in vi_prev_big_word()
183 vi_prev_word(EditLine *el, wint_t c __attribute__((__unused__))) in vi_prev_word() argument
186 if (el->el_line.cursor == el->el_line.buffer) in vi_prev_word()
189 el->el_line.cursor = cv_prev_word(el->el_line.cursor, in vi_prev_word()
190 el->el_line.buffer, in vi_prev_word()
191 el->el_state.argument, in vi_prev_word()
194 if (el->el_chared.c_vcmd.action != NOP) { in vi_prev_word()
195 cv_delfini(el); in vi_prev_word()
208 vi_next_big_word(EditLine *el, wint_t c __attribute__((__unused__))) in vi_next_big_word() argument
211 if (el->el_line.cursor >= el->el_line.lastchar - 1) in vi_next_big_word()
214 el->el_line.cursor = cv_next_word(el, el->el_line.cursor, in vi_next_big_word()
215 el->el_line.lastchar, el->el_state.argument, cv__isWord); in vi_next_big_word()
217 if (el->el_map.type == MAP_VI) in vi_next_big_word()
218 if (el->el_chared.c_vcmd.action != NOP) { in vi_next_big_word()
219 cv_delfini(el); in vi_next_big_word()
232 vi_next_word(EditLine *el, wint_t c __attribute__((__unused__))) in vi_next_word() argument
235 if (el->el_line.cursor >= el->el_line.lastchar - 1) in vi_next_word()
238 el->el_line.cursor = cv_next_word(el, el->el_line.cursor, in vi_next_word()
239 el->el_line.lastchar, el->el_state.argument, cv__isword); in vi_next_word()
241 if (el->el_map.type == MAP_VI) in vi_next_word()
242 if (el->el_chared.c_vcmd.action != NOP) { in vi_next_word()
243 cv_delfini(el); in vi_next_word()
255 vi_change_case(EditLine *el, wint_t c) in vi_change_case() argument
259 if (el->el_line.cursor >= el->el_line.lastchar) in vi_change_case()
261 cv_undo(el); in vi_change_case()
262 for (i = 0; i < el->el_state.argument; i++) { in vi_change_case()
264 c = *el->el_line.cursor; in vi_change_case()
266 *el->el_line.cursor = towlower(c); in vi_change_case()
268 *el->el_line.cursor = towupper(c); in vi_change_case()
270 if (++el->el_line.cursor >= el->el_line.lastchar) { in vi_change_case()
271 el->el_line.cursor--; in vi_change_case()
272 re_fastaddc(el); in vi_change_case()
275 re_fastaddc(el); in vi_change_case()
287 vi_change_meta(EditLine *el, wint_t c __attribute__((__unused__))) in vi_change_meta() argument
294 return cv_action(el, DELETE | INSERT); in vi_change_meta()
304 vi_insert_at_bol(EditLine *el, wint_t c __attribute__((__unused__))) in vi_insert_at_bol() argument
307 el->el_line.cursor = el->el_line.buffer; in vi_insert_at_bol()
308 cv_undo(el); in vi_insert_at_bol()
309 el->el_map.current = el->el_map.key; in vi_insert_at_bol()
320 vi_replace_char(EditLine *el, wint_t c __attribute__((__unused__))) in vi_replace_char() argument
323 if (el->el_line.cursor >= el->el_line.lastchar) in vi_replace_char()
326 el->el_map.current = el->el_map.key; in vi_replace_char()
327 el->el_state.inputmode = MODE_REPLACE_1; in vi_replace_char()
328 cv_undo(el); in vi_replace_char()
339 vi_replace_mode(EditLine *el, wint_t c __attribute__((__unused__))) in vi_replace_mode() argument
342 el->el_map.current = el->el_map.key; in vi_replace_mode()
343 el->el_state.inputmode = MODE_REPLACE; in vi_replace_mode()
344 cv_undo(el); in vi_replace_mode()
355 vi_substitute_char(EditLine *el, wint_t c __attribute__((__unused__))) in vi_substitute_char() argument
358 c_delafter(el, el->el_state.argument); in vi_substitute_char()
359 el->el_map.current = el->el_map.key; in vi_substitute_char()
370 vi_substitute_line(EditLine *el, wint_t c __attribute__((__unused__))) in vi_substitute_line() argument
373 cv_undo(el); in vi_substitute_line()
374 cv_yank(el, el->el_line.buffer, in vi_substitute_line()
375 (int)(el->el_line.lastchar - el->el_line.buffer)); in vi_substitute_line()
376 (void) em_kill_line(el, 0); in vi_substitute_line()
377 el->el_map.current = el->el_map.key; in vi_substitute_line()
388 vi_change_to_eol(EditLine *el, wint_t c __attribute__((__unused__))) in vi_change_to_eol() argument
391 cv_undo(el); in vi_change_to_eol()
392 cv_yank(el, el->el_line.cursor, in vi_change_to_eol()
393 (int)(el->el_line.lastchar - el->el_line.cursor)); in vi_change_to_eol()
394 (void) ed_kill_line(el, 0); in vi_change_to_eol()
395 el->el_map.current = el->el_map.key; in vi_change_to_eol()
406 vi_insert(EditLine *el, wint_t c __attribute__((__unused__))) in vi_insert() argument
409 el->el_map.current = el->el_map.key; in vi_insert()
410 cv_undo(el); in vi_insert()
421 vi_add(EditLine *el, wint_t c __attribute__((__unused__))) in vi_add() argument
425 el->el_map.current = el->el_map.key; in vi_add()
426 if (el->el_line.cursor < el->el_line.lastchar) { in vi_add()
427 el->el_line.cursor++; in vi_add()
428 if (el->el_line.cursor > el->el_line.lastchar) in vi_add()
429 el->el_line.cursor = el->el_line.lastchar; in vi_add()
434 cv_undo(el); in vi_add()
446 vi_add_at_eol(EditLine *el, wint_t c __attribute__((__unused__))) in vi_add_at_eol() argument
449 el->el_map.current = el->el_map.key; in vi_add_at_eol()
450 el->el_line.cursor = el->el_line.lastchar; in vi_add_at_eol()
451 cv_undo(el); in vi_add_at_eol()
462 vi_delete_meta(EditLine *el, wint_t c __attribute__((__unused__))) in vi_delete_meta() argument
465 return cv_action(el, DELETE); in vi_delete_meta()
475 vi_end_big_word(EditLine *el, wint_t c __attribute__((__unused__))) in vi_end_big_word() argument
478 if (el->el_line.cursor == el->el_line.lastchar) in vi_end_big_word()
481 el->el_line.cursor = cv__endword(el->el_line.cursor, in vi_end_big_word()
482 el->el_line.lastchar, el->el_state.argument, cv__isWord); in vi_end_big_word()
484 if (el->el_chared.c_vcmd.action != NOP) { in vi_end_big_word()
485 el->el_line.cursor++; in vi_end_big_word()
486 cv_delfini(el); in vi_end_big_word()
499 vi_end_word(EditLine *el, wint_t c __attribute__((__unused__))) in vi_end_word() argument
502 if (el->el_line.cursor == el->el_line.lastchar) in vi_end_word()
505 el->el_line.cursor = cv__endword(el->el_line.cursor, in vi_end_word()
506 el->el_line.lastchar, el->el_state.argument, cv__isword); in vi_end_word()
508 if (el->el_chared.c_vcmd.action != NOP) { in vi_end_word()
509 el->el_line.cursor++; in vi_end_word()
510 cv_delfini(el); in vi_end_word()
523 vi_undo(EditLine *el, wint_t c __attribute__((__unused__))) in vi_undo() argument
525 c_undo_t un = el->el_chared.c_undo; in vi_undo()
531 el->el_chared.c_undo.buf = el->el_line.buffer; in vi_undo()
532 el->el_chared.c_undo.len = el->el_line.lastchar - el->el_line.buffer; in vi_undo()
533 el->el_chared.c_undo.cursor = in vi_undo()
534 (int)(el->el_line.cursor - el->el_line.buffer); in vi_undo()
535 el->el_line.limit = un.buf + (el->el_line.limit - el->el_line.buffer); in vi_undo()
536 el->el_line.buffer = un.buf; in vi_undo()
537 el->el_line.cursor = un.buf + un.cursor; in vi_undo()
538 el->el_line.lastchar = un.buf + un.len; in vi_undo()
550 vi_command_mode(EditLine *el, wint_t c __attribute__((__unused__))) in vi_command_mode() argument
554 el->el_chared.c_vcmd.action = NOP; in vi_command_mode()
555 el->el_chared.c_vcmd.pos = 0; in vi_command_mode()
557 el->el_state.doingarg = 0; in vi_command_mode()
559 el->el_state.inputmode = MODE_INSERT; in vi_command_mode()
560 el->el_map.current = el->el_map.alt; in vi_command_mode()
562 if (el->el_line.cursor > el->el_line.buffer) in vi_command_mode()
563 el->el_line.cursor--; in vi_command_mode()
574 vi_zero(EditLine *el, wint_t c) in vi_zero() argument
577 if (el->el_state.doingarg) in vi_zero()
578 return ed_argument_digit(el, c); in vi_zero()
580 el->el_line.cursor = el->el_line.buffer; in vi_zero()
581 if (el->el_chared.c_vcmd.action != NOP) { in vi_zero()
582 cv_delfini(el); in vi_zero()
595 vi_delete_prev_char(EditLine *el, wint_t c __attribute__((__unused__))) in vi_delete_prev_char() argument
598 if (el->el_line.cursor <= el->el_line.buffer) in vi_delete_prev_char()
601 c_delbefore1(el); in vi_delete_prev_char()
602 el->el_line.cursor--; in vi_delete_prev_char()
613 vi_list_or_eof(EditLine *el, wint_t c) in vi_list_or_eof() argument
616 if (el->el_line.cursor == el->el_line.lastchar) { in vi_list_or_eof()
617 if (el->el_line.cursor == el->el_line.buffer) { in vi_list_or_eof()
618 terminal_writec(el, c); /* then do a EOF */ in vi_list_or_eof()
625 terminal_beep(el); in vi_list_or_eof()
630 re_goto_bottom(el); in vi_list_or_eof()
631 *el->el_line.lastchar = '\0'; /* just in case */ in vi_list_or_eof()
637 terminal_beep(el); in vi_list_or_eof()
650 vi_kill_line_prev(EditLine *el, wint_t c __attribute__((__unused__))) in vi_kill_line_prev() argument
654 cp = el->el_line.buffer; in vi_kill_line_prev()
655 kp = el->el_chared.c_kill.buf; in vi_kill_line_prev()
656 while (cp < el->el_line.cursor) in vi_kill_line_prev()
658 el->el_chared.c_kill.last = kp; in vi_kill_line_prev()
659 c_delbefore(el, (int)(el->el_line.cursor - el->el_line.buffer)); in vi_kill_line_prev()
660 el->el_line.cursor = el->el_line.buffer; /* zap! */ in vi_kill_line_prev()
671 vi_search_prev(EditLine *el, wint_t c __attribute__((__unused__))) in vi_search_prev() argument
674 return cv_search(el, ED_SEARCH_PREV_HISTORY); in vi_search_prev()
684 vi_search_next(EditLine *el, wint_t c __attribute__((__unused__))) in vi_search_next() argument
687 return cv_search(el, ED_SEARCH_NEXT_HISTORY); in vi_search_next()
697 vi_repeat_search_next(EditLine *el, wint_t c __attribute__((__unused__))) in vi_repeat_search_next() argument
700 if (el->el_search.patlen == 0) in vi_repeat_search_next()
703 return cv_repeat_srch(el, el->el_search.patdir); in vi_repeat_search_next()
713 vi_repeat_search_prev(EditLine *el, wint_t c __attribute__((__unused__))) in vi_repeat_search_prev() argument
716 if (el->el_search.patlen == 0) in vi_repeat_search_prev()
719 return (cv_repeat_srch(el, in vi_repeat_search_prev()
720 el->el_search.patdir == ED_SEARCH_PREV_HISTORY ? in vi_repeat_search_prev()
731 vi_next_char(EditLine *el, wint_t c __attribute__((__unused__))) in vi_next_char() argument
733 return cv_csearch(el, CHAR_FWD, -1, el->el_state.argument, 0); in vi_next_char()
743 vi_prev_char(EditLine *el, wint_t c __attribute__((__unused__))) in vi_prev_char() argument
745 return cv_csearch(el, CHAR_BACK, -1, el->el_state.argument, 0); in vi_prev_char()
755 vi_to_next_char(EditLine *el, wint_t c __attribute__((__unused__))) in vi_to_next_char() argument
757 return cv_csearch(el, CHAR_FWD, -1, el->el_state.argument, 1); in vi_to_next_char()
767 vi_to_prev_char(EditLine *el, wint_t c __attribute__((__unused__))) in vi_to_prev_char() argument
769 return cv_csearch(el, CHAR_BACK, -1, el->el_state.argument, 1); in vi_to_prev_char()
779 vi_repeat_next_char(EditLine *el, wint_t c __attribute__((__unused__))) in vi_repeat_next_char() argument
782 return cv_csearch(el, el->el_search.chadir, el->el_search.chacha, in vi_repeat_next_char()
783 el->el_state.argument, el->el_search.chatflg); in vi_repeat_next_char()
793 vi_repeat_prev_char(EditLine *el, wint_t c __attribute__((__unused__))) in vi_repeat_prev_char() argument
796 int dir = el->el_search.chadir; in vi_repeat_prev_char()
798 r = cv_csearch(el, -dir, el->el_search.chacha, in vi_repeat_prev_char()
799 el->el_state.argument, el->el_search.chatflg); in vi_repeat_prev_char()
800 el->el_search.chadir = dir; in vi_repeat_prev_char()
811 vi_match(EditLine *el, wint_t c __attribute__((__unused__))) in vi_match() argument
818 *el->el_line.lastchar = '\0'; /* just in case */ in vi_match()
820 i = wcscspn(el->el_line.cursor, match_chars); in vi_match()
821 o_ch = el->el_line.cursor[i]; in vi_match()
829 for (cp = &el->el_line.cursor[i]; count; ) { in vi_match()
831 if (cp < el->el_line.buffer || cp >= el->el_line.lastchar) in vi_match()
839 el->el_line.cursor = cp; in vi_match()
841 if (el->el_chared.c_vcmd.action != NOP) { in vi_match()
845 el->el_line.cursor++; in vi_match()
846 cv_delfini(el); in vi_match()
858 vi_undo_line(EditLine *el, wint_t c __attribute__((__unused__))) in vi_undo_line() argument
861 cv_undo(el); in vi_undo_line()
862 return hist_get(el); in vi_undo_line()
872 vi_to_column(EditLine *el, wint_t c __attribute__((__unused__))) in vi_to_column() argument
875 el->el_line.cursor = el->el_line.buffer; in vi_to_column()
876 el->el_state.argument--; in vi_to_column()
877 return ed_next_char(el, 0); in vi_to_column()
886 vi_yank_end(EditLine *el, wint_t c __attribute__((__unused__))) in vi_yank_end() argument
889 cv_yank(el, el->el_line.cursor, in vi_yank_end()
890 (int)(el->el_line.lastchar - el->el_line.cursor)); in vi_yank_end()
900 vi_yank(EditLine *el, wint_t c __attribute__((__unused__))) in vi_yank() argument
903 return cv_action(el, YANK); in vi_yank()
912 vi_comment_out(EditLine *el, wint_t c __attribute__((__unused__))) in vi_comment_out() argument
915 el->el_line.cursor = el->el_line.buffer; in vi_comment_out()
916 c_insert(el, 1); in vi_comment_out()
917 *el->el_line.cursor = '#'; in vi_comment_out()
918 re_refresh(el); in vi_comment_out()
919 return ed_newline(el, 0); in vi_comment_out()
930 vi_alias(EditLine *el, wint_t c __attribute__((__unused__))) in vi_alias() argument
935 if (el->el_chared.c_aliasfun == NULL) in vi_alias()
940 if (el_getc(el, &alias_name[1]) != 1) in vi_alias()
943 alias_text = (*el->el_chared.c_aliasfun)(el->el_chared.c_aliasarg, in vi_alias()
946 el_wpush(el, ct_decode_string(alias_text, &el->el_scratch)); in vi_alias()
956 vi_to_history_line(EditLine *el, wint_t c __attribute__((__unused__))) in vi_to_history_line() argument
958 int sv_event_no = el->el_history.eventno; in vi_to_history_line()
962 if (el->el_history.eventno == 0) { in vi_to_history_line()
963 (void) wcsncpy(el->el_history.buf, el->el_line.buffer, in vi_to_history_line()
965 el->el_history.last = el->el_history.buf + in vi_to_history_line()
966 (el->el_line.lastchar - el->el_line.buffer); in vi_to_history_line()
970 if (!el->el_state.doingarg) { in vi_to_history_line()
971 el->el_history.eventno = 0x7fffffff; in vi_to_history_line()
972 hist_get(el); in vi_to_history_line()
979 el->el_history.eventno = 1; in vi_to_history_line()
980 if (hist_get(el) == CC_ERROR) in vi_to_history_line()
982 el->el_history.eventno = 1 + el->el_history.ev.num in vi_to_history_line()
983 - el->el_state.argument; in vi_to_history_line()
984 if (el->el_history.eventno < 0) { in vi_to_history_line()
985 el->el_history.eventno = sv_event_no; in vi_to_history_line()
989 rval = hist_get(el); in vi_to_history_line()
991 el->el_history.eventno = sv_event_no; in vi_to_history_line()
1001 vi_histedit(EditLine *el, wint_t c __attribute__((__unused__))) in vi_histedit() argument
1013 if (el->el_state.doingarg) { in vi_histedit()
1014 if (vi_to_history_line(el, 0) == CC_ERROR) in vi_histedit()
1023 len = (size_t)(el->el_line.lastchar - el->el_line.buffer); in vi_histedit()
1031 wcsncpy(line, el->el_line.buffer, len); in vi_histedit()
1054 len = (size_t)(el->el_line.limit - el->el_line.buffer); in vi_histedit()
1055 len = mbstowcs(el->el_line.buffer, cp, len); in vi_histedit()
1056 if (len > 0 && el->el_line.buffer[len - 1] == '\n') in vi_histedit()
1061 el->el_line.cursor = el->el_line.buffer; in vi_histedit()
1062 el->el_line.lastchar = el->el_line.buffer + len; in vi_histedit()
1071 return ed_newline(el, 0); in vi_histedit()
1088 vi_history_word(EditLine *el, wint_t c __attribute__((__unused__))) in vi_history_word() argument
1090 const wchar_t *wp = HIST_FIRST(el); in vi_history_word()
1109 } while ((!el->el_state.doingarg || --el->el_state.argument > 0) in vi_history_word()
1112 if (wsp == NULL || (el->el_state.doingarg && el->el_state.argument != 0)) in vi_history_word()
1115 cv_undo(el); in vi_history_word()
1117 if (el->el_line.cursor < el->el_line.lastchar) in vi_history_word()
1118 el->el_line.cursor++; in vi_history_word()
1119 c_insert(el, len + 1); in vi_history_word()
1120 cp = el->el_line.cursor; in vi_history_word()
1121 lim = el->el_line.limit; in vi_history_word()
1126 el->el_line.cursor = cp; in vi_history_word()
1128 el->el_map.current = el->el_map.key; in vi_history_word()
1138 vi_redo(EditLine *el, wint_t c __attribute__((__unused__))) in vi_redo() argument
1140 c_redo_t *r = &el->el_chared.c_redo; in vi_redo()
1142 if (!el->el_state.doingarg && r->count) { in vi_redo()
1143 el->el_state.doingarg = 1; in vi_redo()
1144 el->el_state.argument = r->count; in vi_redo()
1147 el->el_chared.c_vcmd.pos = el->el_line.cursor; in vi_redo()
1148 el->el_chared.c_vcmd.action = r->action; in vi_redo()
1154 el_wpush(el, r->buf); in vi_redo()
1157 el->el_state.thiscmd = r->cmd; in vi_redo()
1158 el->el_state.thisch = r->ch; in vi_redo()
1159 return (*el->el_map.func[r->cmd])(el, r->ch); in vi_redo()