#include <config.h>#include "el.h"Include dependency graph for common.c:

Go to the source code of this file.
Functions | |
| protected el_action_t | ed_end_of_file (EditLine *el, int c __attribute__((__unused__))) |
| protected el_action_t | ed_insert (EditLine *el, int c) |
| protected el_action_t | ed_delete_prev_word (EditLine *el, int c __attribute__((__unused__))) |
| protected el_action_t | ed_delete_next_char (EditLine *el, int c __attribute__((__unused__))) |
| protected el_action_t | ed_kill_line (EditLine *el, int c __attribute__((__unused__))) |
| protected el_action_t | ed_move_to_end (EditLine *el, int c __attribute__((__unused__))) |
| protected el_action_t | ed_move_to_beg (EditLine *el, int c __attribute__((__unused__))) |
| protected el_action_t | ed_transpose_chars (EditLine *el, int c) |
| protected el_action_t | ed_next_char (EditLine *el, int c __attribute__((__unused__))) |
| protected el_action_t | ed_prev_word (EditLine *el, int c __attribute__((__unused__))) |
| protected el_action_t | ed_prev_char (EditLine *el, int c __attribute__((__unused__))) |
| protected el_action_t | ed_quoted_insert (EditLine *el, int c) |
| protected el_action_t | ed_digit (EditLine *el, int c) |
| protected el_action_t | ed_argument_digit (EditLine *el, int c) |
| protected el_action_t | ed_unassigned (EditLine *el, int c __attribute__((__unused__))) |
| protected el_action_t | ed_tty_sigint (EditLine *el __attribute__((__unused__)), int c __attribute__((__unused__))) |
| protected el_action_t | ed_tty_dsusp (EditLine *el __attribute__((__unused__)), int c __attribute__((__unused__))) |
| protected el_action_t | ed_tty_flush_output (EditLine *el __attribute__((__unused__)), int c __attribute__((__unused__))) |
| protected el_action_t | ed_tty_sigquit (EditLine *el __attribute__((__unused__)), int c __attribute__((__unused__))) |
| protected el_action_t | ed_tty_sigtstp (EditLine *el __attribute__((__unused__)), int c __attribute__((__unused__))) |
| protected el_action_t | ed_tty_stop_output (EditLine *el __attribute__((__unused__)), int c __attribute__((__unused__))) |
| protected el_action_t | ed_tty_start_output (EditLine *el __attribute__((__unused__)), int c __attribute__((__unused__))) |
| protected el_action_t | ed_newline (EditLine *el, int c __attribute__((__unused__))) |
| protected el_action_t | ed_delete_prev_char (EditLine *el, int c __attribute__((__unused__))) |
| protected el_action_t | ed_clear_screen (EditLine *el, int c __attribute__((__unused__))) |
| protected el_action_t | ed_redisplay (EditLine *el __attribute__((__unused__)), int c __attribute__((__unused__))) |
| protected el_action_t | ed_start_over (EditLine *el, int c __attribute__((__unused__))) |
| protected el_action_t | ed_sequence_lead_in (EditLine *el __attribute__((__unused__)), int c __attribute__((__unused__))) |
| protected el_action_t | ed_prev_history (EditLine *el, int c __attribute__((__unused__))) |
| protected el_action_t | ed_next_history (EditLine *el, int c __attribute__((__unused__))) |
| protected el_action_t | ed_search_prev_history (EditLine *el, int c __attribute__((__unused__))) |
| protected el_action_t | ed_search_next_history (EditLine *el, int c __attribute__((__unused__))) |
| protected el_action_t | ed_prev_line (EditLine *el, int c __attribute__((__unused__))) |
| protected el_action_t | ed_next_line (EditLine *el, int c __attribute__((__unused__))) |
| protected el_action_t | ed_command (EditLine *el, int c __attribute__((__unused__))) |
| protected el_action_t ed_argument_digit | ( | EditLine * | el, | |
| int | c | |||
| ) |
Definition at line 404 of file common.c.
References el_state_t::argument, CC_ARGHACK, CC_ERROR, el_state_t::doingarg, el, and editline::el_state.
Referenced by vi_zero().
00405 { 00406 00407 if (!isdigit(c)) 00408 return (CC_ERROR); 00409 00410 if (el->el_state.doingarg) { 00411 if (el->el_state.argument > 1000000) 00412 return (CC_ERROR); 00413 el->el_state.argument = (el->el_state.argument * 10) + 00414 (c - '0'); 00415 } else { /* else starting an argument */ 00416 el->el_state.argument = c - '0'; 00417 el->el_state.doingarg = 1; 00418 } 00419 return (CC_ARGHACK); 00420 }
Here is the caller graph for this function:

| protected el_action_t ed_clear_screen | ( | EditLine * | el, | |
| int c | __attribute__((__unused__)) | |||
| ) |
Definition at line 580 of file common.c.
References CC_REFRESH, el, re_clear_display(), and term_clear_screen().
00581 { 00582 00583 term_clear_screen(el); /* clear the whole real screen */ 00584 re_clear_display(el); /* reset everything */ 00585 return (CC_REFRESH); 00586 }
Here is the call graph for this function:

| protected el_action_t ed_command | ( | EditLine * | el, | |
| int c | __attribute__((__unused__)) | |||
| ) |
Definition at line 901 of file common.c.
References c_gets(), CC_REFRESH, el_map_t::current, el, EL_BUFSIZ, editline::el_map, el_map_t::key, parse_line(), re_clear_display(), term__putc(), and term_beep().
00902 { 00903 char tmpbuf[EL_BUFSIZ]; 00904 int tmplen; 00905 00906 tmplen = c_gets(el, tmpbuf, "\n: "); 00907 term__putc('\n'); 00908 00909 if (tmplen < 0 || (tmpbuf[tmplen] = 0, parse_line(el, tmpbuf)) == -1) 00910 term_beep(el); 00911 00912 el->el_map.current = el->el_map.key; 00913 re_clear_display(el); 00914 return CC_REFRESH; 00915 }
Here is the call graph for this function:

| protected el_action_t ed_delete_next_char | ( | EditLine * | el, | |
| int c | __attribute__((__unused__)) | |||
| ) |
Definition at line 133 of file common.c.
References el_state_t::argument, el_line_t::buffer, c_delafter(), CC_EOF, CC_ERROR, CC_REFRESH, el_line_t::cursor, el, editline::el_line, editline::el_map, editline::el_state, el_line_t::lastchar, MAP_VI, STReof, term__flush(), term_overwrite(), and el_map_t::type.
00134 { 00135 #ifdef notdef /* XXX */ 00136 #define EL el->el_line 00137 (void) fprintf(el->el_errlfile, 00138 "\nD(b: %x(%s) c: %x(%s) last: %x(%s) limit: %x(%s)\n", 00139 EL.buffer, EL.buffer, EL.cursor, EL.cursor, EL.lastchar, 00140 EL.lastchar, EL.limit, EL.limit); 00141 #endif 00142 if (el->el_line.cursor == el->el_line.lastchar) { 00143 /* if I'm at the end */ 00144 if (el->el_map.type == MAP_VI) { 00145 if (el->el_line.cursor == el->el_line.buffer) { 00146 /* if I'm also at the beginning */ 00147 #ifdef KSHVI 00148 return (CC_ERROR); 00149 #else 00150 term_overwrite(el, STReof, 4); 00151 /* then do a EOF */ 00152 term__flush(); 00153 return (CC_EOF); 00154 #endif 00155 } else { 00156 #ifdef KSHVI 00157 el->el_line.cursor--; 00158 #else 00159 return (CC_ERROR); 00160 #endif 00161 } 00162 } else { 00163 if (el->el_line.cursor != el->el_line.buffer) 00164 el->el_line.cursor--; 00165 else 00166 return (CC_ERROR); 00167 } 00168 } 00169 c_delafter(el, el->el_state.argument); /* delete after dot */ 00170 if (el->el_line.cursor >= el->el_line.lastchar && 00171 el->el_line.cursor > el->el_line.buffer) 00172 /* bounds check */ 00173 el->el_line.cursor = el->el_line.lastchar - 1; 00174 return (CC_REFRESH); 00175 }
Here is the call graph for this function:

| protected el_action_t ed_delete_prev_char | ( | EditLine * | el, | |
| int c | __attribute__((__unused__)) | |||
| ) |
Definition at line 560 of file common.c.
References el_state_t::argument, el_line_t::buffer, c_delbefore(), CC_ERROR, CC_REFRESH, el_line_t::cursor, el, editline::el_line, and editline::el_state.
00561 { 00562 00563 if (el->el_line.cursor <= el->el_line.buffer) 00564 return (CC_ERROR); 00565 00566 c_delbefore(el, el->el_state.argument); 00567 el->el_line.cursor -= el->el_state.argument; 00568 if (el->el_line.cursor < el->el_line.buffer) 00569 el->el_line.cursor = el->el_line.buffer; 00570 return (CC_REFRESH); 00571 }
Here is the call graph for this function:

| protected el_action_t ed_delete_prev_word | ( | EditLine * | el, | |
| int c | __attribute__((__unused__)) | |||
| ) |
Definition at line 105 of file common.c.
References el_state_t::argument, c_kill_t::buf, el_line_t::buffer, c__prev_word(), c_delbefore(), el_chared_t::c_kill, CC_ERROR, CC_REFRESH, ce__isword(), lineinfo::cursor, el_line_t::cursor, el, editline::el_chared, el_line(), editline::el_line, editline::el_state, c_kill_t::last, and p.
00106 { 00107 char *cp, *p, *kp; 00108 00109 if (el->el_line.cursor == el->el_line.buffer) 00110 return (CC_ERROR); 00111 00112 cp = c__prev_word(el->el_line.cursor, el->el_line.buffer, 00113 el->el_state.argument, ce__isword); 00114 00115 for (p = cp, kp = el->el_chared.c_kill.buf; p < el->el_line.cursor; p++) 00116 *kp++ = *p; 00117 el->el_chared.c_kill.last = kp; 00118 00119 c_delbefore(el, el->el_line.cursor - cp); /* delete before dot */ 00120 el->el_line.cursor = cp; 00121 if (el->el_line.cursor < el->el_line.buffer) 00122 el->el_line.cursor = el->el_line.buffer; /* bounds check */ 00123 return (CC_REFRESH); 00124 }
Here is the call graph for this function:

| protected el_action_t ed_digit | ( | EditLine * | el, | |
| int | c | |||
| ) |
Definition at line 376 of file common.c.
References el_state_t::argument, CC_ARGHACK, CC_ERROR, el_state_t::doingarg, ed_insert(), el, editline::el_state, and el_state_t::lastcmd.
00377 { 00378 00379 if (!isdigit(c)) 00380 return (CC_ERROR); 00381 00382 if (el->el_state.doingarg) { 00383 /* if doing an arg, add this in... */ 00384 if (el->el_state.lastcmd == EM_UNIVERSAL_ARGUMENT) 00385 el->el_state.argument = c - '0'; 00386 else { 00387 if (el->el_state.argument > 1000000) 00388 return (CC_ERROR); 00389 el->el_state.argument = 00390 (el->el_state.argument * 10) + (c - '0'); 00391 } 00392 return (CC_ARGHACK); 00393 } 00394 00395 return ed_insert(el, c); 00396 }
Here is the call graph for this function:

| protected el_action_t ed_end_of_file | ( | EditLine * | el, | |
| int c | __attribute__((__unused__)) | |||
| ) |
Definition at line 48 of file common.c.
References CC_EOF, el, editline::el_line, el_line_t::lastchar, and re_goto_bottom().
Referenced by c_gets(), ce_inc_search(), cv_csearch(), and ed_quoted_insert().
00049 { 00050 00051 re_goto_bottom(el); 00052 *el->el_line.lastchar = '\0'; 00053 return (CC_EOF); 00054 }
Here is the call graph for this function:

Here is the caller graph for this function:

| protected el_action_t ed_insert | ( | EditLine * | el, | |
| int | c | |||
| ) |
Definition at line 62 of file common.c.
References el_state_t::argument, c_insert(), CC_ERROR, CC_NORM, ch_enlargebufs(), count, el_line_t::cursor, el, editline::el_line, editline::el_state, el_state_t::inputmode, el_line_t::lastchar, el_line_t::limit, MODE_INSERT, MODE_REPLACE_1, re_fastaddc(), re_refresh(), and vi_command_mode().
Referenced by ed_digit(), and ed_quoted_insert().
00063 { 00064 int count = el->el_state.argument; 00065 00066 if (c == '\0') 00067 return (CC_ERROR); 00068 00069 if (el->el_line.lastchar + el->el_state.argument >= 00070 el->el_line.limit) { 00071 /* end of buffer space, try to allocate more */ 00072 if (!ch_enlargebufs(el, (size_t) count)) 00073 return CC_ERROR; /* error allocating more */ 00074 } 00075 00076 if (count == 1) { 00077 if (el->el_state.inputmode == MODE_INSERT 00078 || el->el_line.cursor >= el->el_line.lastchar) 00079 c_insert(el, 1); 00080 00081 *el->el_line.cursor++ = c; 00082 re_fastaddc(el); /* fast refresh for one char. */ 00083 } else { 00084 if (el->el_state.inputmode != MODE_REPLACE_1) 00085 c_insert(el, el->el_state.argument); 00086 00087 while (count-- && el->el_line.cursor < el->el_line.lastchar) 00088 *el->el_line.cursor++ = c; 00089 re_refresh(el); 00090 } 00091 00092 if (el->el_state.inputmode == MODE_REPLACE_1) 00093 return vi_command_mode(el, 0); 00094 00095 return (CC_NORM); 00096 }
Here is the call graph for this function:

Here is the caller graph for this function:

| protected el_action_t ed_kill_line | ( | EditLine * | el, | |
| int c | __attribute__((__unused__)) | |||
| ) |
Definition at line 184 of file common.c.
References c_kill_t::buf, el_chared_t::c_kill, CC_REFRESH, el_line_t::cursor, el, editline::el_chared, el_line(), editline::el_line, c_kill_t::last, el_line_t::lastchar, and lineinfo::lastchar.
Referenced by vi_change_to_eol().
00185 { 00186 char *kp, *cp; 00187 00188 cp = el->el_line.cursor; 00189 kp = el->el_chared.c_kill.buf; 00190 while (cp < el->el_line.lastchar) 00191 *kp++ = *cp++; /* copy it */ 00192 el->el_chared.c_kill.last = kp; 00193 /* zap! -- delete to end */ 00194 el->el_line.lastchar = el->el_line.cursor; 00195 return (CC_REFRESH); 00196 }
Here is the call graph for this function:

Here is the caller graph for this function:

| protected el_action_t ed_move_to_beg | ( | EditLine * | el, | |
| int c | __attribute__((__unused__)) | |||
| ) |
Definition at line 228 of file common.c.
References c_vcmd_t::action, el_line_t::buffer, el_chared_t::c_vcmd, CC_CURSOR, CC_REFRESH, el_line_t::cursor, cv_delfini(), el, editline::el_chared, editline::el_line, editline::el_map, MAP_VI, NOP, and el_map_t::type.
00229 { 00230 00231 el->el_line.cursor = el->el_line.buffer; 00232 00233 if (el->el_map.type == MAP_VI) { 00234 /* We want FIRST non space character */ 00235 while (isspace((unsigned char) *el->el_line.cursor)) 00236 el->el_line.cursor++; 00237 if (el->el_chared.c_vcmd.action != NOP) { 00238 cv_delfini(el); 00239 return (CC_REFRESH); 00240 } 00241 } 00242 return (CC_CURSOR); 00243 }
Here is the call graph for this function:

| protected el_action_t ed_move_to_end | ( | EditLine * | el, | |
| int c | __attribute__((__unused__)) | |||
| ) |
Definition at line 205 of file common.c.
References c_vcmd_t::action, el_chared_t::c_vcmd, CC_CURSOR, CC_REFRESH, el_line_t::cursor, cv_delfini(), el, editline::el_chared, editline::el_line, editline::el_map, el_line_t::lastchar, MAP_VI, NOP, and el_map_t::type.
00206 { 00207 00208 el->el_line.cursor = el->el_line.lastchar; 00209 if (el->el_map.type == MAP_VI) { 00210 #ifdef VI_MOVE 00211 el->el_line.cursor--; 00212 #endif 00213 if (el->el_chared.c_vcmd.action != NOP) { 00214 cv_delfini(el); 00215 return (CC_REFRESH); 00216 } 00217 } 00218 return (CC_CURSOR); 00219 }
Here is the call graph for this function:

| protected el_action_t ed_newline | ( | EditLine * | el, | |
| int c | __attribute__((__unused__)) | |||
| ) |
Definition at line 544 of file common.c.
References CC_NEWLINE, el, editline::el_line, el_line_t::lastchar, and re_goto_bottom().
Referenced by cv_search(), vi_comment_out(), and vi_histedit().
00545 { 00546 00547 re_goto_bottom(el); 00548 *el->el_line.lastchar++ = '\n'; 00549 *el->el_line.lastchar = '\0'; 00550 return (CC_NEWLINE); 00551 }
Here is the call graph for this function:

Here is the caller graph for this function:

| protected el_action_t ed_next_char | ( | EditLine * | el, | |
| int c | __attribute__((__unused__)) | |||
| ) |
Definition at line 277 of file common.c.
References c_vcmd_t::action, el_state_t::argument, el_chared_t::c_vcmd, CC_CURSOR, CC_ERROR, CC_REFRESH, el_line_t::cursor, cv_delfini(), el, editline::el_chared, editline::el_line, editline::el_map, editline::el_state, el_line_t::lastchar, MAP_VI, NOP, and el_map_t::type.
Referenced by vi_to_column().
00278 { 00279 char *lim = el->el_line.lastchar; 00280 00281 if (el->el_line.cursor >= lim || 00282 (el->el_line.cursor == lim - 1 && 00283 el->el_map.type == MAP_VI && 00284 el->el_chared.c_vcmd.action == NOP)) 00285 return (CC_ERROR); 00286 00287 el->el_line.cursor += el->el_state.argument; 00288 if (el->el_line.cursor > lim) 00289 el->el_line.cursor = lim; 00290 00291 if (el->el_map.type == MAP_VI) 00292 if (el->el_chared.c_vcmd.action != NOP) { 00293 cv_delfini(el); 00294 return (CC_REFRESH); 00295 } 00296 return (CC_CURSOR); 00297 }
Here is the call graph for this function:

Here is the caller graph for this function:

| protected el_action_t ed_next_history | ( | EditLine * | el, | |
| int c | __attribute__((__unused__)) | |||
| ) |
Definition at line 675 of file common.c.
References el_state_t::argument, el_chared_t::c_undo, CC_REFRESH, CC_REFRESH_BEEP, el, editline::el_chared, editline::el_history, editline::el_line, editline::el_state, el_history_t::eventno, hist_get(), el_line_t::lastchar, and c_undo_t::len.
00676 { 00677 el_action_t beep = CC_REFRESH, rval; 00678 00679 el->el_chared.c_undo.len = -1; 00680 *el->el_line.lastchar = '\0'; /* just in case */ 00681 00682 el->el_history.eventno -= el->el_state.argument; 00683 00684 if (el->el_history.eventno < 0) { 00685 el->el_history.eventno = 0; 00686 beep = CC_REFRESH_BEEP; 00687 } 00688 rval = hist_get(el); 00689 if (rval == CC_REFRESH) 00690 return beep; 00691 return rval; 00692 00693 }
Here is the call graph for this function:

| protected el_action_t ed_next_line | ( | EditLine * | el, | |
| int c | __attribute__((__unused__)) | |||
| ) |
Definition at line 867 of file common.c.
References el_state_t::argument, c_hpos(), CC_CURSOR, CC_ERROR, el_line_t::cursor, el, el_line(), editline::el_line, editline::el_state, el_line_t::lastchar, and lineinfo::lastchar.
00868 { 00869 char *ptr; 00870 int nchars = c_hpos(el); 00871 00872 /* 00873 * Move to the line requested 00874 */ 00875 for (ptr = el->el_line.cursor; ptr < el->el_line.lastchar; ptr++) 00876 if (*ptr == '\n' && --el->el_state.argument <= 0) 00877 break; 00878 00879 if (el->el_state.argument > 0) 00880 return (CC_ERROR); 00881 00882 /* 00883 * Move to the character requested 00884 */ 00885 for (ptr++; 00886 nchars-- > 0 && ptr < el->el_line.lastchar && *ptr != '\n'; 00887 ptr++) 00888 continue; 00889 00890 el->el_line.cursor = ptr; 00891 return (CC_CURSOR); 00892 }
Here is the call graph for this function:

| protected el_action_t ed_prev_char | ( | EditLine * | el, | |
| int c | __attribute__((__unused__)) | |||
| ) |
Definition at line 332 of file common.c.
References c_vcmd_t::action, el_state_t::argument, el_line_t::buffer, el_chared_t::c_vcmd, CC_CURSOR, CC_ERROR, CC_REFRESH, el_line_t::cursor, cv_delfini(), el, editline::el_chared, editline::el_line, editline::el_map, editline::el_state, MAP_VI, NOP, and el_map_t::type.
00333 { 00334 00335 if (el->el_line.cursor > el->el_line.buffer) { 00336 el->el_line.cursor -= el->el_state.argument; 00337 if (el->el_line.cursor < el->el_line.buffer) 00338 el->el_line.cursor = el->el_line.buffer; 00339 00340 if (el->el_map.type == MAP_VI) 00341 if (el->el_chared.c_vcmd.action != NOP) { 00342 cv_delfini(el); 00343 return (CC_REFRESH); 00344 } 00345 return (CC_CURSOR); 00346 } else 00347 return (CC_ERROR); 00348 }
Here is the call graph for this function:

| protected el_action_t ed_prev_history | ( | EditLine * | el, | |
| int c | __attribute__((__unused__)) | |||
| ) |
Definition at line 637 of file common.c.
References el_state_t::argument, el_history_t::buf, el_line_t::buffer, el_chared_t::c_undo, CC_ERROR, CC_REFRESH, CC_REFRESH_BEEP, el, EL_BUFSIZ, editline::el_chared, editline::el_history, editline::el_line, editline::el_map, editline::el_state, el_history_t::eventno, hist_get(), el_history_t::last, el_line_t::lastchar, c_undo_t::len, MAP_VI, and el_map_t::type.
00638 { 00639 char beep = 0; 00640 int sv_event = el->el_history.eventno; 00641 00642 el->el_chared.c_undo.len = -1; 00643 *el->el_line.lastchar = '\0'; /* just in case */ 00644 00645 if (el->el_history.eventno == 0) { /* save the current buffer 00646 * away */ 00647 (void) strncpy(el->el_history.buf, el->el_line.buffer, 00648 EL_BUFSIZ); 00649 el->el_history.last = el->el_history.buf + 00650 (el->el_line.lastchar - el->el_line.buffer); 00651 } 00652 el->el_history.eventno += el->el_state.argument; 00653 00654 if (hist_get(el) == CC_ERROR) { 00655 if (el->el_map.type == MAP_VI) { 00656 el->el_history.eventno = sv_event; 00657 return CC_ERROR; 00658 } 00659 beep = 1; 00660 /* el->el_history.eventno was fixed by first call */ 00661 (void) hist_get(el); 00662 } 00663 if (beep) 00664 return CC_REFRESH_BEEP; 00665 return CC_REFRESH; 00666 }
Here is the call graph for this function:

| protected el_action_t ed_prev_line | ( | EditLine * | el, | |
| int c | __attribute__((__unused__)) | |||
| ) |
Definition at line 824 of file common.c.
References el_state_t::argument, el_line_t::buffer, c_hpos(), CC_CURSOR, CC_ERROR, el_line_t::cursor, el, editline::el_line, editline::el_state, and el_line_t::lastchar.
00825 { 00826 char *ptr; 00827 int nchars = c_hpos(el); 00828 00829 /* 00830 * Move to the line requested 00831 */ 00832 if (*(ptr = el->el_line.cursor) == '\n') 00833 ptr--; 00834 00835 for (; ptr >= el->el_line.buffer; ptr--) 00836 if (*ptr == '\n' && --el->el_state.argument <= 0) 00837 break; 00838 00839 if (el->el_state.argument > 0) 00840 return (CC_ERROR); 00841 00842 /* 00843 * Move to the beginning of the line 00844 */ 00845 for (ptr--; ptr >= el->el_line.buffer && *ptr != '\n'; ptr--) 00846 continue; 00847 00848 /* 00849 * Move to the character requested 00850 */ 00851 for (ptr++; 00852 nchars-- > 0 && ptr < el->el_line.lastchar && *ptr != '\n'; 00853 ptr++) 00854 continue; 00855 00856 el->el_line.cursor = ptr; 00857 return (CC_CURSOR); 00858 }
Here is the call graph for this function:

| protected el_action_t ed_prev_word | ( | EditLine * | el, | |
| int c | __attribute__((__unused__)) | |||
| ) |
Definition at line 306 of file common.c.
References c_vcmd_t::action, el_state_t::argument, el_line_t::buffer, c__prev_word(), el_chared_t::c_vcmd, CC_CURSOR, CC_ERROR, CC_REFRESH, ce__isword(), el_line_t::cursor, cv_delfini(), el, editline::el_chared, editline::el_line, editline::el_map, editline::el_state, MAP_VI, NOP, and el_map_t::type.
00307 { 00308 00309 if (el->el_line.cursor == el->el_line.buffer) 00310 return (CC_ERROR); 00311 00312 el->el_line.cursor = c__prev_word(el->el_line.cursor, 00313 el->el_line.buffer, 00314 el->el_state.argument, 00315 ce__isword); 00316 00317 if (el->el_map.type == MAP_VI) 00318 if (el->el_chared.c_vcmd.action != NOP) { 00319 cv_delfini(el); 00320 return (CC_REFRESH); 00321 } 00322 return (CC_CURSOR); 00323 }
Here is the call graph for this function:

| protected el_action_t ed_quoted_insert | ( | EditLine * | el, | |
| int | c | |||
| ) |
Definition at line 356 of file common.c.
References ed_end_of_file(), ed_insert(), el, el_getc(), tty_noquotemode(), and tty_quotemode().
00357 { 00358 int num; 00359 char tc; 00360 00361 tty_quotemode(el); 00362 num = el_getc(el, &tc); 00363 c = (unsigned char) tc; 00364 tty_noquotemode(el); 00365 if (num == 1) 00366 return (ed_insert(el, c)); 00367 else 00368 return (ed_end_of_file(el, 0)); 00369 }
Here is the call graph for this function:

| protected el_action_t ed_redisplay | ( | EditLine *el | __attribute__((__unused__)), | |
| int c | __attribute__((__unused__)) | |||
| ) |
Definition at line 595 of file common.c.
References CC_REDISPLAY.
Referenced by sig_handler().
00597 { 00598 00599 return (CC_REDISPLAY); 00600 }
Here is the caller graph for this function:

| protected el_action_t ed_search_next_history | ( | EditLine * | el, | |
| int c | __attribute__((__unused__)) | |||
| ) |
Definition at line 770 of file common.c.
References c_vcmd_t::action, el_history_t::buf, el_line_t::buffer, c_hmatch(), c_setpat(), el_chared_t::c_undo, el_chared_t::c_vcmd, CC_ERROR, el, editline::el_chared, editline::el_errfile, editline::el_history, editline::el_line, el_history_t::eventno, h, HIST_FIRST, hist_get(), HIST_NEXT, el_line_t::lastchar, c_undo_t::len, NOP, NULL, and el_history_t::ref.
Referenced by cv_repeat_srch(), and cv_search().
00771 { 00772 const char *hp; 00773 int h; 00774 bool_t found = 0; 00775 00776 el->el_chared.c_vcmd.action = NOP; 00777 el->el_chared.c_undo.len = -1; 00778 *el->el_line.lastchar = '\0'; /* just in case */ 00779 00780 if (el->el_history.eventno == 0) 00781 return (CC_ERROR); 00782 00783 if (el->el_history.ref == NULL) 00784 return (CC_ERROR); 00785 00786 hp = HIST_FIRST(el); 00787 if (hp == NULL) 00788 return (CC_ERROR); 00789 00790 c_setpat(el); /* Set search pattern !! */ 00791 00792 for (h = 1; h < el->el_history.eventno && hp; h++) { 00793 #ifdef SDEBUG 00794 (void) fprintf(el->el_errfile, "Comparing with \"%s\"\n", hp); 00795 #endif 00796 if ((strncmp(hp, el->el_line.buffer, (size_t) 00797 (el->el_line.lastchar - el->el_line.buffer)) || 00798 hp[el->el_line.lastchar - el->el_line.buffer]) && 00799 c_hmatch(el, hp)) 00800 found = h; 00801 hp = HIST_NEXT(el); 00802 } 00803 00804 if (!found) { /* is it the current history number? */ 00805 if (!c_hmatch(el, el->el_history.buf)) { 00806 #ifdef SDEBUG 00807 (void) fprintf(el->el_errfile, "not found\n"); 00808 #endif 00809 return (CC_ERROR); 00810 } 00811 } 00812 el->el_history.eventno = found; 00813 00814 return (hist_get(el)); 00815 }
Here is the call graph for this function:

Here is the caller graph for this function:

| protected el_action_t ed_search_prev_history | ( | EditLine * | el, | |
| int c | __attribute__((__unused__)) | |||
| ) |
Definition at line 702 of file common.c.
References c_vcmd_t::action, el_history_t::buf, el_line_t::buffer, c_hmatch(), c_setpat(), el_chared_t::c_undo, el_chared_t::c_vcmd, CC_ERROR, el, EL_BUFSIZ, editline::el_chared, editline::el_errfile, editline::el_history, editline::el_line, el_history_t::eventno, h, HIST_FIRST, hist_get(), HIST_NEXT, el_history_t::last, el_line_t::lastchar, c_undo_t::len, NOP, NULL, and el_history_t::ref.
Referenced by cv_repeat_srch(), and cv_search().
00703 { 00704 const char *hp; 00705 int h; 00706 bool_t found = 0; 00707 00708 el->el_chared.c_vcmd.action = NOP; 00709 el->el_chared.c_undo.len = -1; 00710 *el->el_line.lastchar = '\0'; /* just in case */ 00711 if (el->el_history.eventno < 0) { 00712 #ifdef DEBUG_EDIT 00713 (void) fprintf(el->el_errfile, 00714 "e_prev_search_hist(): eventno < 0;\n"); 00715 #endif 00716 el->el_history.eventno = 0; 00717 return (CC_ERROR); 00718 } 00719 if (el->el_history.eventno == 0) { 00720 (void) strncpy(el->el_history.buf, el->el_line.buffer, 00721 EL_BUFSIZ); 00722 el->el_history.last = el->el_history.buf + 00723 (el->el_line.lastchar - el->el_line.buffer); 00724 } 00725 if (el->el_history.ref == NULL) 00726 return (CC_ERROR); 00727 00728 hp = HIST_FIRST(el); 00729 if (hp == NULL) 00730 return (CC_ERROR); 00731 00732 c_setpat(el); /* Set search pattern !! */ 00733 00734 for (h = 1; h <= el->el_history.eventno; h++) 00735 hp = HIST_NEXT(el); 00736 00737 while (hp != NULL) { 00738 #ifdef SDEBUG 00739 (void) fprintf(el->el_errfile, "Comparing with \"%s\"\n", hp); 00740 #endif 00741 if ((strncmp(hp, el->el_line.buffer, (size_t) 00742 (el->el_line.lastchar - el->el_line.buffer)) || 00743 hp[el->el_line.lastchar - el->el_line.buffer]) && 00744 c_hmatch(el, hp)) { 00745 found++; 00746 break; 00747 } 00748 h++; 00749 hp = HIST_NEXT(el); 00750 } 00751 00752 if (!found) { 00753 #ifdef SDEBUG 00754 (void) fprintf(el->el_errfile, "not found\n"); 00755 #endif 00756 return (CC_ERROR); 00757 } 00758 el->el_history.eventno = h; 00759 00760 return (hist_get(el)); 00761 }
Here is the call graph for this function:

Here is the caller graph for this function:

| protected el_action_t ed_sequence_lead_in | ( | EditLine *el | __attribute__((__unused__)), | |
| int c | __attribute__((__unused__)) | |||
| ) |
| protected el_action_t ed_start_over | ( | EditLine * | el, | |
| int c | __attribute__((__unused__)) | |||
| ) |
Definition at line 609 of file common.c.
References CC_REFRESH, ch_reset(), and el.
00610 { 00611 00612 ch_reset(el); 00613 return (CC_REFRESH); 00614 }
Here is the call graph for this function:

| protected el_action_t ed_transpose_chars | ( | EditLine * | el, | |
| int | c | |||
| ) |
Definition at line 251 of file common.c.
References el_line_t::buffer, CC_ERROR, CC_REFRESH, el_line_t::cursor, el, editline::el_line, and el_line_t::lastchar.
00252 { 00253 00254 if (el->el_line.cursor < el->el_line.lastchar) { 00255 if (el->el_line.lastchar <= &el->el_line.buffer[1]) 00256 return (CC_ERROR); 00257 else 00258 el->el_line.cursor++; 00259 } 00260 if (el->el_line.cursor > &el->el_line.buffer[1]) { 00261 /* must have at least two chars entered */ 00262 c = el->el_line.cursor[-2]; 00263 el->el_line.cursor[-2] = el->el_line.cursor[-1]; 00264 el->el_line.cursor[-1] = c; 00265 return (CC_REFRESH); 00266 } else 00267 return (CC_ERROR); 00268 }
| protected el_action_t ed_tty_dsusp | ( | EditLine *el | __attribute__((__unused__)), | |
| int c | __attribute__((__unused__)) | |||
| ) |
| protected el_action_t ed_tty_flush_output | ( | EditLine *el | __attribute__((__unused__)), | |
| int c | __attribute__((__unused__)) | |||
| ) |
| protected el_action_t ed_tty_sigint | ( | EditLine *el | __attribute__((__unused__)), | |
| int c | __attribute__((__unused__)) | |||
| ) |
| protected el_action_t ed_tty_sigquit | ( | EditLine *el | __attribute__((__unused__)), | |
| int c | __attribute__((__unused__)) | |||
| ) |
| protected el_action_t ed_tty_sigtstp | ( | EditLine *el | __attribute__((__unused__)), | |
| int c | __attribute__((__unused__)) | |||
| ) |
| protected el_action_t ed_tty_start_output | ( | EditLine *el | __attribute__((__unused__)), | |
| int c | __attribute__((__unused__)) | |||
| ) |
| protected el_action_t ed_tty_stop_output | ( | EditLine *el | __attribute__((__unused__)), | |
| int c | __attribute__((__unused__)) | |||
| ) |
| protected el_action_t ed_unassigned | ( | EditLine * | el, | |
| int c | __attribute__((__unused__)) | |||
| ) |
1.4.7

