MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / ed_insert

Function ed_insert

extern/editline/src/common.c:68–103  ·  view source on GitHub ↗

ed_insert(): * Add character to the line * Insert a character [bound to all insert keys] */

Source from the content-addressed store, hash-verified

66 * Insert a character [bound to all insert keys]
67 */
68protected el_action_t
69ed_insert(EditLine *el, Int c)
70{
71 int count = el->el_state.argument;
72
73 if (c == '\0')
74 return CC_ERROR;
75
76 if (el->el_line.lastchar + el->el_state.argument >=
77 el->el_line.limit) {
78 /* end of buffer space, try to allocate more */
79 if (!ch_enlargebufs(el, (size_t) count))
80 return CC_ERROR; /* error allocating more */
81 }
82
83 if (count == 1) {
84 if (el->el_state.inputmode == MODE_INSERT
85 || el->el_line.cursor >= el->el_line.lastchar)
86 c_insert(el, 1);
87
88 *el->el_line.cursor++ = c;
89 re_fastaddc(el); /* fast refresh for one char. */
90 } else {
91 if (el->el_state.inputmode != MODE_REPLACE_1)
92 c_insert(el, el->el_state.argument);
93
94 while (count-- && el->el_line.cursor < el->el_line.lastchar)
95 *el->el_line.cursor++ = c;
96 re_refresh(el);
97 }
98
99 if (el->el_state.inputmode == MODE_REPLACE_1)
100 return vi_command_mode(el, 0);
101
102 return CC_NORM;
103}
104
105
106/* ed_delete_prev_word():

Callers 2

ed_quoted_insertFunction · 0.85
ed_digitFunction · 0.85

Calls 5

ch_enlargebufsFunction · 0.85
c_insertFunction · 0.85
re_fastaddcFunction · 0.85
re_refreshFunction · 0.85
vi_command_modeFunction · 0.85

Tested by

no test coverage detected