cv_paste(): * Paste previous deletion before or after the cursor */
| 90 | * Paste previous deletion before or after the cursor |
| 91 | */ |
| 92 | private el_action_t |
| 93 | cv_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(): |
no test coverage detected