tweaks: fold two blocks into each other, to elide three overlapping cases

master
Benno Schulenberg 2020-03-31 19:30:08 +02:00
parent 38bbdf8fc3
commit 56a111afa3
1 changed files with 1 additions and 18 deletions

View File

@ -592,7 +592,6 @@ void copy_text(void)
/* Create OR add to the cutbuffer, depending on the mode, the position
* of the cursor, and whether or not the cutbuffer is currently empty. */
if (ISSET(CUT_FROM_CURSOR)) {
if (cutbuffer == NULL && sans_newline) {
cutbuffer = addition;
cutbottom = addition;
@ -606,32 +605,16 @@ void copy_text(void)
addition->prev->next = addition;
delete_node(cutbottom);
cutbottom = addition;
} else {
} else if (ISSET(CUT_FROM_CURSOR)) {
addition->prev = cutbottom;
cutbottom->next = addition;
cutbottom = addition;
}
} else {
if (cutbuffer == NULL && sans_newline ) {
cutbuffer = addition;
cutbottom = addition;
} else if (cutbuffer == NULL) {
cutbuffer = addition;
cutbottom = make_new_node(cutbuffer);
cutbottom->data = copy_of("");
cutbuffer->next = cutbottom;
} else if (sans_newline) {
addition->prev = cutbottom->prev;
addition->prev->next = addition;
delete_node(cutbottom);
cutbottom = addition;
} else {
addition->prev = cutbottom->prev;
addition->prev->next = addition;
addition->next = cutbottom;
cutbottom->prev = addition;
}
}
if ((!ISSET(CUT_FROM_CURSOR) || at_eol) && openfile->current->next) {
openfile->current = openfile->current->next;