tweaks: normalize the indentation after the previous change

Also improve a comment.
master
Benno Schulenberg 2020-03-31 19:38:47 +02:00
parent 56a111afa3
commit ce9cfdaa45
1 changed files with 26 additions and 24 deletions

View File

@ -560,7 +560,9 @@ void copy_marked_region(void)
botline->next = afterline; botline->next = afterline;
} }
/* Copy text from the current buffer into the cutbuffer. */ /* Copy text from the current buffer into the cutbuffer. The text is either
* the marked region, the whole line, the text from cursor to end-of-line,
* just the line break, or nothing, depending on mode and cursor position. */
void copy_text(void) void copy_text(void)
{ {
bool at_eol = (openfile->current->data[openfile->current_x] == '\0'); bool at_eol = (openfile->current->data[openfile->current_x] == '\0');
@ -592,29 +594,29 @@ void copy_text(void)
/* Create OR add to the cutbuffer, depending on the mode, the position /* Create OR add to the cutbuffer, depending on the mode, the position
* of the cursor, and whether or not the cutbuffer is currently empty. */ * of the cursor, and whether or not the cutbuffer is currently empty. */
if (cutbuffer == NULL && sans_newline) { if (cutbuffer == NULL && sans_newline) {
cutbuffer = addition; cutbuffer = addition;
cutbottom = addition; cutbottom = addition;
} else if (cutbuffer == NULL) { } else if (cutbuffer == NULL) {
cutbuffer = addition; cutbuffer = addition;
cutbottom = make_new_node(cutbuffer); cutbottom = make_new_node(cutbuffer);
cutbottom->data = copy_of(""); cutbottom->data = copy_of("");
cutbuffer->next = cutbottom; cutbuffer->next = cutbottom;
} else if (sans_newline) { } else if (sans_newline) {
addition->prev = cutbottom->prev; addition->prev = cutbottom->prev;
addition->prev->next = addition; addition->prev->next = addition;
delete_node(cutbottom); delete_node(cutbottom);
cutbottom = addition; cutbottom = addition;
} else if (ISSET(CUT_FROM_CURSOR)) { } else if (ISSET(CUT_FROM_CURSOR)) {
addition->prev = cutbottom; addition->prev = cutbottom;
cutbottom->next = addition; cutbottom->next = addition;
cutbottom = addition; cutbottom = addition;
} else { } else {
addition->prev = cutbottom->prev; addition->prev = cutbottom->prev;
addition->prev->next = addition; addition->prev->next = addition;
addition->next = cutbottom; addition->next = cutbottom;
cutbottom->prev = addition; cutbottom->prev = addition;
} }
if ((!ISSET(CUT_FROM_CURSOR) || at_eol) && openfile->current->next) { if ((!ISSET(CUT_FROM_CURSOR) || at_eol) && openfile->current->next) {
openfile->current = openfile->current->next; openfile->current = openfile->current->next;