diff --git a/ChangeLog b/ChangeLog index fc70a676..139abe93 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,7 @@ * src/files.c: Unwrap some lines and rewrap some others in a more congenial manner; tweak some comments and whitespace and braces. * src/files.c (read_line): Remove two lines of dead code. + * src/files.c (read_line): Rearrange a few lines and some whitespace. 2015-07-06 Benno Schulenberg * src/global.c (add_to_sclist), src/help.c (help_init), src/nano.h, diff --git a/src/files.c b/src/files.c index 5f0fb12b..53a34e55 100644 --- a/src/files.c +++ b/src/files.c @@ -590,18 +590,18 @@ filestruct *read_line(char *buf, filestruct *prevnode, bool /* Special case: we're inserting into the first line. */ fileptr->prev = NULL; fileptr->next = openfile->fileage; - fileptr->lineno = 1; - *first_line_ins = FALSE; - /* Make sure that our edit window stays on the first line. */ - openfile->edittop = fileptr; openfile->fileage = fileptr; + fileptr->lineno = 1; + /* Make sure that our edit window stays on the first line. */ + openfile->edittop = fileptr; + *first_line_ins = FALSE; } else { assert(prevnode != NULL); + prevnode->next = fileptr; fileptr->prev = prevnode; fileptr->next = NULL; fileptr->lineno = prevnode->lineno + 1; - prevnode->next = fileptr; } return fileptr;