tweaks: reshuffle a condition, and adjust a comment and some indentation
parent
f2f901c895
commit
0f2b0ffbd3
28
src/files.c
28
src/files.c
|
@ -1933,16 +1933,16 @@ bool write_file(const char *name, FILE *f_open, bool tmp,
|
||||||
goto cleanup_and_exit;
|
goto cleanup_and_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (method == OVERWRITE && !tmp) {
|
/* When having written an entire buffer, update some administrivia. */
|
||||||
/* If we must set the filename, and it changed, adjust things. */
|
if (fullbuffer && method == OVERWRITE && !tmp) {
|
||||||
if (fullbuffer && strcmp(openfile->filename, realname) != 0) {
|
/* If the filename was changed, check if this means a new syntax. */
|
||||||
|
if (strcmp(openfile->filename, realname) != 0) {
|
||||||
#ifdef ENABLE_COLOR
|
#ifdef ENABLE_COLOR
|
||||||
const char *oldname, *newname;
|
const char *oldname, *newname;
|
||||||
|
|
||||||
oldname = openfile->syntax ? openfile->syntax->name : "";
|
oldname = openfile->syntax ? openfile->syntax->name : "";
|
||||||
#endif
|
#endif
|
||||||
openfile->filename = mallocstrcpy(openfile->filename, realname);
|
openfile->filename = mallocstrcpy(openfile->filename, realname);
|
||||||
|
|
||||||
#ifdef ENABLE_COLOR
|
#ifdef ENABLE_COLOR
|
||||||
/* See if the applicable syntax has changed. */
|
/* See if the applicable syntax has changed. */
|
||||||
color_update();
|
color_update();
|
||||||
|
@ -1959,29 +1959,27 @@ bool write_file(const char *name, FILE *f_open, bool tmp,
|
||||||
line->multidata = NULL;
|
line->multidata = NULL;
|
||||||
line = line->next;
|
line = line->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
precalc_multicolorinfo();
|
precalc_multicolorinfo();
|
||||||
refresh_needed = TRUE;
|
refresh_needed = TRUE;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fullbuffer) {
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
/* Get or update the stat info to reflect the current state. */
|
/* Get or update the stat info to reflect the current state. */
|
||||||
stat_with_alloc(realname, &openfile->current_stat);
|
stat_with_alloc(realname, &openfile->current_stat);
|
||||||
|
|
||||||
/* Record at which point in the undo stack the file was saved. */
|
/* Record at which point in the undo stack the file was saved. */
|
||||||
openfile->last_saved = openfile->current_undo;
|
openfile->last_saved = openfile->current_undo;
|
||||||
openfile->last_action = OTHER;
|
openfile->last_action = OTHER;
|
||||||
#endif
|
#endif
|
||||||
openfile->modified = FALSE;
|
openfile->modified = FALSE;
|
||||||
titlebar(NULL);
|
titlebar(NULL);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!tmp)
|
if (!tmp)
|
||||||
statusline(HUSH, P_("Wrote %zu line", "Wrote %zu lines",
|
statusline(HUSH, P_("Wrote %zu line", "Wrote %zu lines",
|
||||||
lineswritten), lineswritten);
|
lineswritten), lineswritten);
|
||||||
retval = TRUE;
|
retval = TRUE;
|
||||||
|
|
||||||
cleanup_and_exit:
|
cleanup_and_exit:
|
||||||
|
|
Loading…
Reference in New Issue