commit c640a55b1cddda1c0679ce9bf333379023881383
parent 7d0b7e47c11a340ce1bb5bec6303583dbd73b106
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Fri, 28 Feb 2020 18:59:04 +0100
tweaks: frob a statement, rewrap two lines, and remove a pair of braces
Diffstat:
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/src/text.c b/src/text.c
@@ -1156,14 +1156,15 @@ void add_undo(undo_type action, const char *message)
}
/* Fall-through. */
case JOIN:
- if (openfile->current->next) {
+ if (openfile->current->next != NULL) {
if (u->type == BACK) {
u->head_lineno = openfile->current->next->lineno;
u->head_x = 0;
}
u->strdata = copy_of(openfile->current->next->data);
}
- action = u->type = JOIN;
+ u->type = JOIN;
+ action = JOIN;
break;
case REPLACE:
u->strdata = copy_of(openfile->current->data);
@@ -1306,10 +1307,9 @@ void update_undo(undo_type action)
memmove(u->strdata + charlen, u->strdata, datalen + 1);
strncpy(u->strdata, textposition, charlen);
u->head_x = openfile->current_x;
- } else {
+ } else
/* They deleted *elsewhere* on the line: start a new undo item. */
add_undo(u->type, NULL);
- }
break;
case JOIN:
break;
@@ -1345,8 +1345,7 @@ void update_undo(undo_type action)
u->head_x = strlen(bottomline->data);
if (u->head_lineno == u->tail_lineno)
u->head_x += u->tail_x;
- } else if (openfile->current == openfile->filebot &&
- ISSET(NO_NEWLINES))
+ } else if (openfile->current == openfile->filebot && ISSET(NO_NEWLINES))
u->head_x = strlen(bottomline->data);
}
break;