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

Function cv_paste

extern/editline/src/vi.c:92–116  ·  view source on GitHub ↗

cv_paste(): * Paste previous deletion before or after the cursor */

Source from the content-addressed store, hash-verified

90 * Paste previous deletion before or after the cursor
91 */
92private el_action_t
93cv_paste(EditLine *el, Int c)
94{
95 c_kill_t *k = &el->el_chared.c_kill;
96 size_t len = (size_t)(k->last - k->buf);
97
98 if (k->buf == NULL || len == 0)
99 return CC_ERROR;
100#ifdef DEBUG_PASTE
101 (void) fprintf(el->el_errfile, "Paste: \"%.*s\"\n", (int)len, k->buf);
102#endif
103
104 cv_undo(el);
105
106 if (!c && el->el_line.cursor < el->el_line.lastchar)
107 el->el_line.cursor++;
108
109 c_insert(el, (int)len);
110 if (el->el_line.cursor + len > el->el_line.lastchar)
111 return CC_ERROR;
112 (void) memcpy(el->el_line.cursor, k->buf, len *
113 sizeof(*el->el_line.cursor));
114
115 return CC_REFRESH;
116}
117
118
119/* vi_paste_next():

Callers 2

vi_paste_nextFunction · 0.85
vi_paste_prevFunction · 0.85

Calls 2

cv_undoFunction · 0.85
c_insertFunction · 0.85

Tested by

no test coverage detected