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

Go to the source code of this file.
Defines | |
| #define | EL_LEAVE 2 |
Functions | |
| protected void | cv_undo (EditLine *el) |
| protected void | cv_yank (EditLine *el, const char *ptr, int size) |
| protected void | c_insert (EditLine *el, int num) |
| protected void | c_delafter (EditLine *el, int num) |
| protected void | c_delafter1 (EditLine *el) |
| protected void | c_delbefore (EditLine *el, int num) |
| protected void | c_delbefore1 (EditLine *el) |
| protected int | ce__isword (int p) |
| protected int | cv__isword (int p) |
| protected int | cv__isWord (int p) |
| protected char * | c__prev_word (char *p, char *low, int n, int(*wtest)(int)) |
| protected char * | c__next_word (char *p, char *high, int n, int(*wtest)(int)) |
| protected char * | cv_next_word (EditLine *el, char *p, char *high, int n, int(*wtest)(int)) |
| protected char * | cv_prev_word (char *p, char *low, int n, int(*wtest)(int)) |
| protected void | cv_delfini (EditLine *el) |
| protected char * | cv__endword (char *p, char *high, int n, int(*wtest)(int)) |
| protected int | ch_init (EditLine *el) |
| protected void | ch_reset (EditLine *el) |
| protected int | ch_enlargebufs (EditLine *el, size_t addlen) |
| protected void | ch_end (EditLine *el) |
| public int | el_insertstr (EditLine *el, const char *s) |
| public void | el_deletestr (EditLine *el, int n) |
| protected int | c_gets (EditLine *el, char *buf, const char *prompt) |
| protected int | c_hpos (EditLine *el) |
| #define EL_LEAVE 2 |
| protected char* c__next_word | ( | char * | p, | |
| char * | high, | |||
| int | n, | |||
| int(*)(int) | wtest | |||
| ) |
Definition at line 251 of file chared.c.
Referenced by ce_inc_search(), em_capitol_case(), em_delete_next_word(), em_lower_case(), em_next_word(), and em_upper_case().
00252 { 00253 while (n--) { 00254 while ((p < high) && !(*wtest)((unsigned char) *p)) 00255 p++; 00256 while ((p < high) && (*wtest)((unsigned char) *p)) 00257 p++; 00258 } 00259 if (p > high) 00260 p = high; 00261 /* p now points where we want it */ 00262 return (p); 00263 }
Here is the caller graph for this function:

| protected char* c__prev_word | ( | char * | p, | |
| char * | low, | |||
| int | n, | |||
| int(*)(int) | wtest | |||
| ) |
Definition at line 227 of file chared.c.
Referenced by ed_delete_prev_word(), ed_prev_word(), and em_copy_prev_word().
00228 { 00229 p--; 00230 00231 while (n--) { 00232 while ((p >= low) && !(*wtest)((unsigned char) *p)) 00233 p--; 00234 while ((p >= low) && (*wtest)((unsigned char) *p)) 00235 p--; 00236 } 00237 00238 /* cp now points to one character before the word */ 00239 p++; 00240 if (p < low) 00241 p = low; 00242 /* cp now points where we want it */ 00243 return (p); 00244 }
Here is the caller graph for this function:

| protected void c_delafter | ( | EditLine * | el, | |
| int | num | |||
| ) |
Definition at line 109 of file chared.c.
References el_map_t::current, el_line_t::cursor, cv_undo(), cv_yank(), el, editline::el_line, el_line(), editline::el_map, el_map_t::emacs, el_line_t::lastchar, and lineinfo::lastchar.
Referenced by cv_delfini(), ed_delete_next_char(), em_delete_next_word(), em_delete_or_list(), em_kill_region(), and vi_substitute_char().
00110 { 00111 00112 if (el->el_line.cursor + num > el->el_line.lastchar) 00113 num = el->el_line.lastchar - el->el_line.cursor; 00114 00115 if (el->el_map.current != el->el_map.emacs) { 00116 cv_undo(el); 00117 cv_yank(el, el->el_line.cursor, num); 00118 } 00119 00120 if (num > 0) { 00121 char *cp; 00122 00123 for (cp = el->el_line.cursor; cp <= el->el_line.lastchar; cp++) 00124 *cp = cp[num]; 00125 00126 el->el_line.lastchar -= num; 00127 } 00128 }
Here is the call graph for this function:

Here is the caller graph for this function:

| protected void c_delafter1 | ( | EditLine * | el | ) |
Definition at line 135 of file chared.c.
References el_line_t::cursor, el, editline::el_line, el_line(), lineinfo::lastchar, and el_line_t::lastchar.
Referenced by em_delete_or_list().
00136 { 00137 char *cp; 00138 00139 for (cp = el->el_line.cursor; cp <= el->el_line.lastchar; cp++) 00140 *cp = cp[1]; 00141 00142 el->el_line.lastchar--; 00143 }
Here is the call graph for this function:

Here is the caller graph for this function:

| protected void c_delbefore | ( | EditLine * | el, | |
| int | num | |||
| ) |
Definition at line 150 of file chared.c.
References lineinfo::buffer, el_line_t::buffer, el_map_t::current, el_line_t::cursor, cv_undo(), cv_yank(), el, editline::el_line, el_line(), editline::el_map, el_map_t::emacs, lineinfo::lastchar, and el_line_t::lastchar.
Referenced by cv_delfini(), ed_delete_prev_char(), ed_delete_prev_word(), el_deletestr(), em_delete_prev_char(), em_kill_region(), and vi_kill_line_prev().
00151 { 00152 00153 if (el->el_line.cursor - num < el->el_line.buffer) 00154 num = el->el_line.cursor - el->el_line.buffer; 00155 00156 if (el->el_map.current != el->el_map.emacs) { 00157 cv_undo(el); 00158 cv_yank(el, el->el_line.cursor - num, num); 00159 } 00160 00161 if (num > 0) { 00162 char *cp; 00163 00164 for (cp = el->el_line.cursor - num; 00165 cp <= el->el_line.lastchar; 00166 cp++) 00167 *cp = cp[num]; 00168 00169 el->el_line.lastchar -= num; 00170 } 00171 }
Here is the call graph for this function:

Here is the caller graph for this function:

| protected void c_delbefore1 | ( | EditLine * | el | ) |
Definition at line 178 of file chared.c.
References el_line_t::cursor, el, editline::el_line, el_line(), lineinfo::lastchar, and el_line_t::lastchar.
Referenced by em_delete_prev_char(), and vi_delete_prev_char().
00179 { 00180 char *cp; 00181 00182 for (cp = el->el_line.cursor - 1; cp <= el->el_line.lastchar; cp++) 00183 *cp = cp[1]; 00184 00185 el->el_line.lastchar--; 00186 }
Here is the call graph for this function:

Here is the caller graph for this function:

| protected int c_gets | ( | EditLine * | el, | |
| char * | buf, | |||
| const char * | prompt | |||
| ) |
Definition at line 676 of file chared.c.
References el_line_t::buffer, el_line_t::cursor, ed_end_of_file(), el, EL_BUFSIZ, el_getc(), editline::el_line, el_line_t::lastchar, memcpy, re_refresh(), strlen(), and term_beep().
Referenced by cv_search(), and ed_command().
00677 { 00678 char ch; 00679 int len; 00680 char *cp = el->el_line.buffer; 00681 00682 if (prompt) { 00683 len = strlen(prompt); 00684 memcpy(cp, prompt, len + 0u); 00685 cp += len; 00686 } 00687 len = 0; 00688 00689 for (;;) { 00690 el->el_line.cursor = cp; 00691 *cp = ' '; 00692 el->el_line.lastchar = cp + 1; 00693 re_refresh(el); 00694 00695 if (el_getc(el, &ch) != 1) { 00696 ed_end_of_file(el, 0); 00697 len = -1; 00698 break; 00699 } 00700 00701 switch (ch) { 00702 00703 case 0010: /* Delete and backspace */ 00704 case 0177: 00705 if (len <= 0) { 00706 len = -1; 00707 break; 00708 } 00709 cp--; 00710 continue; 00711 00712 case 0033: /* ESC */ 00713 case '\r': /* Newline */ 00714 case '\n': 00715 buf[len] = ch; 00716 break; 00717 00718 default: 00719 if (len >= EL_BUFSIZ - 16) 00720 term_beep(el); 00721 else { 00722 buf[len++] = ch; 00723 *cp++ = ch; 00724 } 00725 continue; 00726 } 00727 break; 00728 } 00729 00730 el->el_line.buffer[0] = '\0'; 00731 el->el_line.lastchar = el->el_line.buffer; 00732 el->el_line.cursor = el->el_line.buffer; 00733 return len; 00734 }
Here is the call graph for this function:

Here is the caller graph for this function:

| protected int c_hpos | ( | EditLine * | el | ) |
Definition at line 741 of file chared.c.
References el_line_t::buffer, el_line_t::cursor, el, and editline::el_line.
Referenced by ed_next_line(), and ed_prev_line().
00742 { 00743 char *ptr; 00744 00745 /* 00746 * Find how many characters till the beginning of this line. 00747 */ 00748 if (el->el_line.cursor == el->el_line.buffer) 00749 return (0); 00750 else { 00751 for (ptr = el->el_line.cursor - 1; 00752 ptr >= el->el_line.buffer && *ptr != '\n'; 00753 ptr--) 00754 continue; 00755 return (el->el_line.cursor - ptr - 1); 00756 } 00757 }
Here is the caller graph for this function:

| protected void c_insert | ( | EditLine * | el, | |
| int | num | |||
| ) |
Definition at line 87 of file chared.c.
References ch_enlargebufs(), el_line_t::cursor, el, editline::el_line, el_line_t::lastchar, and el_line_t::limit.
Referenced by cv_paste(), ed_insert(), el_insertstr(), em_copy_prev_word(), em_yank(), vi_comment_out(), and vi_history_word().
00088 { 00089 char *cp; 00090 00091 if (el->el_line.lastchar + num >= el->el_line.limit) { 00092 if (!ch_enlargebufs(el, num +0u)) 00093 return; /* can't go past end of buffer */ 00094 } 00095 00096 if (el->el_line.cursor < el->el_line.lastchar) { 00097 /* if I must move chars */ 00098 for (cp = el->el_line.lastchar; cp >= el->el_line.cursor; cp--) 00099 cp[num] = *cp; 00100 } 00101 el->el_line.lastchar += num; 00102 }
Here is the call graph for this function:

Here is the caller graph for this function:

| protected int ce__isword | ( | int | p | ) |
Definition at line 193 of file chared.c.
References NULL, and strchr().
Referenced by ce_inc_search(), ed_delete_prev_word(), ed_prev_word(), em_capitol_case(), em_copy_prev_word(), em_delete_next_word(), em_lower_case(), em_next_word(), and em_upper_case().
Here is the call graph for this function:

Here is the caller graph for this function:

| protected void ch_end | ( | EditLine * | el | ) |
Definition at line 612 of file chared.c.
References c_undo_t::buf, c_redo_t::buf, c_kill_t::buf, el_line_t::buffer, el_chared_t::c_kill, el_chared_t::c_macro, el_chared_t::c_redo, el_chared_t::c_undo, ch_reset(), c_redo_t::cmd, el, editline::el_chared, el_free, editline::el_line, c_redo_t::lim, el_line_t::limit, c_macro_t::macro, NULL, and c_redo_t::pos.
Referenced by el_end().
00613 { 00614 el_free((ptr_t) el->el_line.buffer); 00615 el->el_line.buffer = NULL; 00616 el->el_line.limit = NULL; 00617 el_free((ptr_t) el->el_chared.c_undo.buf); 00618 el->el_chared.c_undo.buf = NULL; 00619 el_free((ptr_t) el->el_chared.c_redo.buf); 00620 el->el_chared.c_redo.buf = NULL; 00621 el->el_chared.c_redo.pos = NULL; 00622 el->el_chared.c_redo.lim = NULL; 00623 el->el_chared.c_redo.cmd = ED_UNASSIGNED; 00624 el_free((ptr_t) el->el_chared.c_kill.buf); 00625 el->el_chared.c_kill.buf = NULL; 00626 el_free((ptr_t) el->el_chared.c_macro.macro); 00627 el->el_chared.c_macro.macro = NULL; 00628 ch_reset(el); 00629 }
Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 526 of file chared.c.
References EL_LEAVE, el_realloc, hist_enlargebuf(), and memset.
Referenced by c_insert(), ed_insert(), el_gets(), and el_insertstr().
00529 { 00530 size_t sz, newsz; 00531 char *newbuffer, *oldbuf, *oldkbuf; 00532 00533 sz = el->el_line.limit - el->el_line.buffer + EL_LEAVE; 00534 newsz = sz * 2; 00535 /* 00536 * If newly required length is longer than current buffer, we need 00537 * to make the buffer big enough to hold both old and new stuff. 00538 */ 00539 if (addlen > sz) { 00540 while(newsz - sz < addlen) 00541 newsz *= 2; 00542 } 00543 00544 /* 00545 * Reallocate line buffer. 00546 */ 00547 newbuffer = el_realloc(el->el_line.buffer, newsz); 00548 if (!newbuffer) 00549 return 0; 00550 00551 /* zero the newly added memory, leave old data in */ 00552 (void) memset(&newbuffer[sz], 0, newsz - sz); 00553 00554 oldbuf = el->el_line.buffer; 00555 00556 el->el_line.buffer = newbuffer; 00557 el->el_line.cursor = newbuffer + (el->el_line.cursor - oldbuf); 00558 el->el_line.lastchar = newbuffer + (el->el_line.lastchar - oldbuf); 00559 /* don't set new size until all buffers are enlarged */ 00560 el->el_line.limit = &newbuffer[sz - EL_LEAVE]; 00561 00562 /* 00563 * Reallocate kill buffer. 00564 */ 00565 newbuffer = el_realloc(el->el_chared.c_kill.buf, newsz); 00566 if (!newbuffer) 00567 return 0; 00568 00569 /* zero the newly added memory, leave old data in */ 00570 (void) memset(&newbuffer[sz], 0, newsz - sz); 00571 00572 oldkbuf = el->el_chared.c_kill.buf; 00573 00574 el->el_chared.c_kill.buf = newbuffer; 00575 el->el_chared.c_kill.last = newbuffer + 00576 (el->el_chared.c_kill.last - oldkbuf); 00577 el->el_chared.c_kill.mark = el->el_line.buffer + 00578 (el->el_chared.c_kill.mark - oldbuf); 00579 00580 /* 00581 * Reallocate undo buffer. 00582 */ 00583 newbuffer = el_realloc(el->el_chared.c_undo.buf, newsz); 00584 if (!newbuffer) 00585 return 0; 00586 00587 /* zero the newly added memory, leave old data in */ 00588 (void) memset(&newbuffer[sz], 0, newsz - sz); 00589 el->el_chared.c_undo.buf = newbuffer; 00590 00591 newbuffer = el_realloc(el->el_chared.c_redo.buf, newsz); 00592 if (!newbuffer) 00593 return 0; 00594 el->el_chared.c_redo.pos = newbuffer + 00595 (el->el_chared.c_redo.pos - el->el_chared.c_redo.buf); 00596 el->el_chared.c_redo.lim = newbuffer + 00597 (el->el_chared.c_redo.lim - el->el_chared.c_redo.buf); 00598 el->el_chared.c_redo.buf = newbuffer; 00599 00600 if (!hist_enlargebuf(el, sz, newsz)) 00601 return 0; 00602 00603 /* Safe to set enlarged buffer size */ 00604 el->el_line.limit = &el->el_line.buffer[newsz - EL_LEAVE]; 00605 return 1; 00606 }
Here is the call graph for this function:

Here is the caller graph for this function:

| protected int ch_init | ( | EditLine * | el | ) |
Definition at line 440 of file chared.c.
References c_vcmd_t::action, el_state_t::argument, c_undo_t::buf, c_redo_t::buf, c_kill_t::buf, el_line_t::buffer, el_chared_t::c_kill, el_chared_t::c_macro, el_chared_t::c_redo, el_chared_t::c_undo, el_chared_t::c_vcmd, c_redo_t::cmd, el_map_t::current, el_line_t::cursor, c_undo_t::cursor, el_state_t::doingarg, el, EL_BUFSIZ, editline::el_chared, EL_LEAVE, editline::el_line, el_malloc, editline::el_map, EL_MAXMACRO, editline::el_state, el_state_t::inputmode, el_map_t::key, c_kill_t::last, el_line_t::lastchar, el_state_t::lastcmd, c_undo_t::len, c_macro_t::level, c_redo_t::lim, el_line_t::limit, c_macro_t::macro, c_kill_t::mark, memset, el_state_t::metanext, MODE_INSERT, NOP, NULL, c_macro_t::offset, c_redo_t::pos, and c_vcmd_t::pos.
Referenced by el_init().
00441 { 00442 el->el_line.buffer = (char *) el_malloc(EL_BUFSIZ); 00443 if (el->el_line.buffer == NULL) 00444 return (-1); 00445 00446 (void) memset(el->el_line.buffer, 0, EL_BUFSIZ); 00447 el->el_line.cursor = el->el_line.buffer; 00448 el->el_line.lastchar = el->el_line.buffer; 00449 el->el_line.limit = &el->el_line.buffer[EL_BUFSIZ - EL_LEAVE]; 00450 00451 el->el_chared.c_undo.buf = (char *) el_malloc(EL_BUFSIZ); 00452 if (el->el_chared.c_undo.buf == NULL) 00453 return (-1); 00454 (void) memset(el->el_chared.c_undo.buf, 0, EL_BUFSIZ); 00455 el->el_chared.c_undo.len = -1; 00456 el->el_chared.c_undo.cursor = 0; 00457 el->el_chared.c_redo.buf = (char *) el_malloc(EL_BUFSIZ); 00458 if (el->el_chared.c_redo.buf == NULL) 00459 return (-1); 00460 el->el_chared.c_redo.pos = el->el_chared.c_redo.buf; 00461 el->el_chared.c_redo.lim = el->el_chared.c_redo.buf + EL_BUFSIZ; 00462 el->el_chared.c_redo.cmd = ED_UNASSIGNED; 00463 00464 el->el_chared.c_vcmd.action = NOP; 00465 el->el_chared.c_vcmd.pos = el->el_line.buffer; 00466 00467 el->el_chared.c_kill.buf = (char *) el_malloc(EL_BUFSIZ); 00468 if (el->el_chared.c_kill.buf == NULL) 00469 return (-1); 00470 (void) memset(el->el_chared.c_kill.buf, 0, EL_BUFSIZ); 00471 el->el_chared.c_kill.mark = el->el_line.buffer; 00472 el->el_chared.c_kill.last = el->el_chared.c_kill.buf; 00473 00474 el->el_map.current = el->el_map.key; 00475 00476 el->el_state.inputmode = MODE_INSERT; /* XXX: save a default */ 00477 el->el_state.doingarg = 0; 00478 el->el_state.metanext = 0; 00479 el->el_state.argument = 1; 00480 el->el_state.lastcmd = ED_UNASSIGNED; 00481 00482 el->el_chared.c_macro.level = -1; 00483 el->el_chared.c_macro.offset = 0; 00484 el->el_chared.c_macro.macro = (char **) el_malloc(EL_MAXMACRO * 00485 sizeof(char *)); 00486 if (el->el_chared.c_macro.macro == NULL) 00487 return (-1); 00488 return (0); 00489 }
Here is the caller graph for this function:

| protected void ch_reset | ( | EditLine * | el | ) |
Definition at line 495 of file chared.c.
References c_vcmd_t::action, el_state_t::argument, el_line_t::buffer, el_chared_t::c_kill, el_chared_t::c_macro, el_chared_t::c_undo, el_chared_t::c_vcmd, el_map_t::current, el_line_t::cursor, c_undo_t::cursor, el_state_t::doingarg, el, editline::el_chared, editline::el_history, editline::el_line, editline::el_map, editline::el_state, el_history_t::eventno, el_state_t::inputmode, el_map_t::key, el_line_t::lastchar, el_state_t::lastcmd, c_undo_t::len, c_macro_t::level, c_kill_t::mark, el_state_t::metanext, MODE_INSERT, NOP, and c_vcmd_t::pos.
Referenced by ch_end(), ed_start_over(), el_reset(), and read_prepare().
00496 { 00497 el->el_line.cursor = el->el_line.buffer; 00498 el->el_line.lastchar = el->el_line.buffer; 00499 00500 el->el_chared.c_undo.len = -1; 00501 el->el_chared.c_undo.cursor = 0; 00502 00503 el->el_chared.c_vcmd.action = NOP; 00504 el->el_chared.c_vcmd.pos = el->el_line.buffer; 00505 00506 el->el_chared.c_kill.mark = el->el_line.buffer; 00507 00508 el->el_map.current = el->el_map.key; 00509 00510 el->el_state.inputmode = MODE_INSERT; /* XXX: save a default */ 00511 el->el_state.doingarg = 0; 00512 el->el_state.metanext = 0; 00513 el->el_state.argument = 1; 00514 el->el_state.lastcmd = ED_UNASSIGNED; 00515 00516 el->el_chared.c_macro.level = -1; 00517 00518 el->el_history.eventno = 0; 00519 }
Here is the caller graph for this function:

| protected char* cv__endword | ( | char * | p, | |
| char * | high, | |||
| int | n, | |||
| int(*)(int) | wtest | |||
| ) |
Definition at line 418 of file chared.c.
References test.
Referenced by vi_end_big_word(), and vi_end_word().
00419 { 00420 int test; 00421 00422 p++; 00423 00424 while (n--) { 00425 while ((p < high) && isspace((unsigned char) *p)) 00426 p++; 00427 00428 test = (*wtest)((unsigned char) *p); 00429 while ((p < high) && (*wtest)((unsigned char) *p) == test) 00430 p++; 00431 } 00432 p--; 00433 return (p); 00434 }
Here is the caller graph for this function:

| protected int cv__isWord | ( | int | p | ) |
Definition at line 217 of file chared.c.
Referenced by vi_end_big_word(), vi_next_big_word(), and vi_prev_big_word().
00218 { 00219 return (!isspace(p)); 00220 }
Here is the caller graph for this function:

| protected int cv__isword | ( | int | p | ) |
Definition at line 203 of file chared.c.
Referenced by vi_end_word(), vi_next_word(), and vi_prev_word().
00204 { 00205 if (isalnum(p) || p == '_') 00206 return 1; 00207 if (isgraph(p)) 00208 return 2; 00209 return 0; 00210 }
Here is the caller graph for this function:

| protected void cv_delfini | ( | EditLine * | el | ) |
Definition at line 358 of file chared.c.
References action, c_vcmd_t::action, c_delafter(), c_delbefore(), el_chared_t::c_vcmd, el_map_t::current, el_line_t::cursor, cv_yank(), el, editline::el_chared, editline::el_line, editline::el_map, INSERT, el_map_t::key, NOP, c_vcmd_t::pos, re_refresh_cursor(), and YANK.
Referenced by cv_csearch(), ed_move_to_beg(), ed_move_to_end(), ed_next_char(), ed_prev_char(), ed_prev_word(), em_next_word(), vi_end_big_word(), vi_end_word(), vi_match(), vi_next_big_word(), vi_next_word(), vi_prev_big_word(), vi_prev_word(), and vi_zero().
00359 { 00360 int size; 00361 int action = el->el_chared.c_vcmd.action; 00362 00363 if (action & INSERT) 00364 el->el_map.current = el->el_map.key; 00365 00366 if (el->el_chared.c_vcmd.pos == 0) 00367 /* sanity */ 00368 return; 00369 00370 size = el->el_line.cursor - el->el_chared.c_vcmd.pos; 00371 if (size == 0) 00372 size = 1; 00373 el->el_line.cursor = el->el_chared.c_vcmd.pos; 00374 if (action & YANK) { 00375 if (size > 0) 00376 cv_yank(el, el->el_line.cursor, size); 00377 else 00378 cv_yank(el, el->el_line.cursor + size, -size); 00379 } else { 00380 if (size > 0) { 00381 c_delafter(el, size); 00382 re_refresh_cursor(el); 00383 } else { 00384 c_delbefore(el, -size); 00385 el->el_line.cursor += size; 00386 } 00387 } 00388 el->el_chared.c_vcmd.action = NOP; 00389 }
Here is the call graph for this function:

Here is the caller graph for this function:

| protected char* cv_next_word | ( | EditLine * | el, | |
| char * | p, | |||
| char * | high, | |||
| int | n, | |||
| int(*)(int) | wtest | |||
| ) |
Definition at line 269 of file chared.c.
References c_vcmd_t::action, el_chared_t::c_vcmd, DELETE, el, editline::el_chared, INSERT, and test.
Referenced by vi_next_big_word(), and vi_next_word().
00270 { 00271 int test; 00272 00273 while (n--) { 00274 test = (*wtest)((unsigned char) *p); 00275 while ((p < high) && (*wtest)((unsigned char) *p) == test) 00276 p++; 00277 /* 00278 * vi historically deletes with cw only the word preserving the 00279 * trailing whitespace! This is not what 'w' does.. 00280 */ 00281 if (n || el->el_chared.c_vcmd.action != (DELETE|INSERT)) 00282 while ((p < high) && isspace((unsigned char) *p)) 00283 p++; 00284 } 00285 00286 /* p now points where we want it */ 00287 if (p > high) 00288 return (high); 00289 else 00290 return (p); 00291 }
Here is the caller graph for this function:

| protected char* cv_prev_word | ( | char * | p, | |
| char * | low, | |||
| int | n, | |||
| int(*)(int) | wtest | |||
| ) |
Definition at line 298 of file chared.c.
References test.
Referenced by vi_prev_big_word(), and vi_prev_word().
00299 { 00300 int test; 00301 00302 p--; 00303 while (n--) { 00304 while ((p > low) && isspace((unsigned char) *p)) 00305 p--; 00306 test = (*wtest)((unsigned char) *p); 00307 while ((p >= low) && (*wtest)((unsigned char) *p) == test) 00308 p--; 00309 } 00310 p++; 00311 00312 /* p now points where we want it */ 00313 if (p < low) 00314 return (low); 00315 else 00316 return (p); 00317 }
Here is the caller graph for this function:

| protected void cv_undo | ( | EditLine * | el | ) |
Definition at line 50 of file chared.c.
References c_redo_t::action, c_vcmd_t::action, el_state_t::argument, c_undo_t::buf, c_redo_t::buf, el_line_t::buffer, el_chared_t::c_redo, el_chared_t::c_undo, el_chared_t::c_vcmd, c_redo_t::ch, c_redo_t::cmd, c_redo_t::count, c_undo_t::cursor, el_line_t::cursor, el_state_t::doingarg, el, editline::el_chared, editline::el_line, editline::el_state, el_line_t::lastchar, c_undo_t::len, memcpy, c_redo_t::pos, el_state_t::thisch, and el_state_t::thiscmd.
Referenced by c_delafter(), c_delbefore(), cv_action(), cv_paste(), vi_add(), vi_add_at_eol(), vi_change_case(), vi_change_to_eol(), vi_history_word(), vi_insert(), vi_insert_at_bol(), vi_replace_char(), vi_replace_mode(), vi_substitute_line(), and vi_undo_line().
00051 { 00052 c_undo_t *vu = &el->el_chared.c_undo; 00053 c_redo_t *r = &el->el_chared.c_redo; 00054 int size; 00055 00056 /* Save entire line for undo */ 00057 size = el->el_line.lastchar - el->el_line.buffer; 00058 vu->len = size; 00059 vu->cursor = el->el_line.cursor - el->el_line.buffer; 00060 memcpy(vu->buf, el->el_line.buffer, (size_t)size); 00061 00062 /* save command info for redo */ 00063 r->count = el->el_state.doingarg ? el->el_state.argument : 0; 00064 r->action = el->el_chared.c_vcmd.action; 00065 r->pos = r->buf; 00066 r->cmd = el->el_state.thiscmd; 00067 r->ch = el->el_state.thisch; 00068 }
Here is the caller graph for this function:

| protected void cv_yank | ( | EditLine * | el, | |
| const char * | ptr, | |||
| int | size | |||
| ) |
Definition at line 74 of file chared.c.
References c_kill_t::buf, el_chared_t::c_kill, el, editline::el_chared, c_kill_t::last, and memcpy.
Referenced by c_delafter(), c_delbefore(), cv_action(), cv_delfini(), vi_change_to_eol(), vi_substitute_line(), and vi_yank_end().
00075 { 00076 c_kill_t *k = &el->el_chared.c_kill; 00077 00078 memcpy(k->buf, ptr, size +0u); 00079 k->last = k->buf + size; 00080 }
Here is the caller graph for this function:

| public void el_deletestr | ( | EditLine * | el, | |
| int | n | |||
| ) |
Definition at line 658 of file chared.c.
References el_line_t::buffer, c_delbefore(), el_line_t::cursor, el, and editline::el_line.
Referenced by _rl_complete_internal().
00659 { 00660 if (n <= 0) 00661 return; 00662 00663 if (el->el_line.cursor < &el->el_line.buffer[n]) 00664 return; 00665 00666 c_delbefore(el, n); /* delete before dot */ 00667 el->el_line.cursor -= n; 00668 if (el->el_line.cursor < el->el_line.buffer) 00669 el->el_line.cursor = el->el_line.buffer; 00670 }
Here is the call graph for this function:

Here is the caller graph for this function:

| public int el_insertstr | ( | EditLine * | el, | |
| const char * | s | |||
| ) |
Definition at line 636 of file chared.c.
References c_insert(), ch_enlargebufs(), el_line_t::cursor, el, editline::el_line, el_line_t::lastchar, el_line_t::limit, and strlen().
Referenced by _rl_complete_internal(), complete(), rl_complete(), and rl_stuff_char().
00637 { 00638 size_t len; 00639 00640 if ((len = strlen(s)) == 0) 00641 return (-1); 00642 if (el->el_line.lastchar + len >= el->el_line.limit) { 00643 if (!ch_enlargebufs(el, len)) 00644 return (-1); 00645 } 00646 00647 c_insert(el, (int)len); 00648 while (*s) 00649 *el->el_line.cursor++ = *s++; 00650 return (0); 00651 }
Here is the call graph for this function:

Here is the caller graph for this function:

1.4.7

