copy paste now functional

master
bx 2022-04-02 22:36:17 +01:00
parent a06db018fa
commit 8f917f058c
2 changed files with 13 additions and 0 deletions

View File

@ -22,3 +22,14 @@ c_copy(char *c) {
}
}
void
c_paste(char *c) {
Row *line = b_getline(buffer, atoi(c + 2));
if (line == NULL) {puts("invalid line."); return; }
if (clipboard == NULL) {puts("empty clipboard"); return; }
for (Row *cb = clipboard; cb->n != NULL; cb = cb->n) {
line = b_insert(line);
memcpy(line->text, cb->text, ROW_SIZE);
}
}

View File

@ -10,6 +10,8 @@ NULL,
[']'] = c_indent,
['d'] = c_delete,
['c'] = c_copy,
['v'] = c_paste,
};