tweaks: reshuffle a condition, and adjust a comment and some indentation

master
Benno Schulenberg 2018-05-31 16:27:13 +02:00
parent f2f901c895
commit 0f2b0ffbd3
1 changed files with 13 additions and 15 deletions

View File

@ -1933,16 +1933,16 @@ bool write_file(const char *name, FILE *f_open, bool tmp,
goto cleanup_and_exit;
}
if (method == OVERWRITE && !tmp) {
/* If we must set the filename, and it changed, adjust things. */
if (fullbuffer && strcmp(openfile->filename, realname) != 0) {
/* When having written an entire buffer, update some administrivia. */
if (fullbuffer && method == OVERWRITE && !tmp) {
/* If the filename was changed, check if this means a new syntax. */
if (strcmp(openfile->filename, realname) != 0) {
#ifdef ENABLE_COLOR
const char *oldname, *newname;
oldname = openfile->syntax ? openfile->syntax->name : "";
#endif
openfile->filename = mallocstrcpy(openfile->filename, realname);
#ifdef ENABLE_COLOR
/* See if the applicable syntax has changed. */
color_update();
@ -1959,13 +1959,12 @@ bool write_file(const char *name, FILE *f_open, bool tmp,
line->multidata = NULL;
line = line->next;
}
precalc_multicolorinfo();
refresh_needed = TRUE;
}
#endif
}
if (fullbuffer) {
#ifndef NANO_TINY
/* Get or update the stat info to reflect the current state. */
stat_with_alloc(realname, &openfile->current_stat);
@ -1977,7 +1976,6 @@ bool write_file(const char *name, FILE *f_open, bool tmp,
openfile->modified = FALSE;
titlebar(NULL);
}
}
if (!tmp)
statusline(HUSH, P_("Wrote %zu line", "Wrote %zu lines",