tweaks: move a function to related ones, and after one that it calls

master
Benno Schulenberg 2020-02-02 12:25:09 +01:00
parent 16c4f5bbd0
commit 88087f2b2f
2 changed files with 17 additions and 18 deletions

View File

@ -131,22 +131,6 @@ void make_new_buffer(void)
#endif #endif
} }
/* Mark the current file as modified if it isn't already, and
* then update the title bar to display the file's new status. */
void set_modified(void)
{
if (openfile->modified)
return;
openfile->modified = TRUE;
titlebar(NULL);
#ifndef NANO_TINY
if (openfile->lock_filename != NULL)
write_lockfile(openfile->lock_filename, openfile->filename, TRUE);
#endif
}
#ifndef NANO_TINY #ifndef NANO_TINY
/* Delete the lockfile. Return -1 if unsuccessful, and 1 otherwise. */ /* Delete the lockfile. Return -1 if unsuccessful, and 1 otherwise. */
int delete_lockfile(const char *lockfilename) int delete_lockfile(const char *lockfilename)
@ -536,6 +520,22 @@ bool replace_buffer(const char *filename, undo_type action, bool marked,
} }
#endif /* ENABLE_SPELLER */ #endif /* ENABLE_SPELLER */
/* Mark the current file as modified if it isn't already, and
* then update the title bar to display the file's new status. */
void set_modified(void)
{
if (openfile->modified)
return;
openfile->modified = TRUE;
titlebar(NULL);
#ifndef NANO_TINY
if (openfile->lock_filename != NULL)
write_lockfile(openfile->lock_filename, openfile->filename, TRUE);
#endif
}
/* Update the title bar and the multiline cache to match the current buffer. */ /* Update the title bar and the multiline cache to match the current buffer. */
void prepare_for_display(void) void prepare_for_display(void)
{ {

View File

@ -282,12 +282,12 @@ void make_new_buffer(void);
#ifndef NANO_TINY #ifndef NANO_TINY
int delete_lockfile(const char *lockfilename); int delete_lockfile(const char *lockfilename);
#endif #endif
void set_modified(void);
bool open_buffer(const char *filename, bool new_buffer); bool open_buffer(const char *filename, bool new_buffer);
#ifdef ENABLE_SPELLER #ifdef ENABLE_SPELLER
bool replace_buffer(const char *filename, undo_type action, bool marked, bool replace_buffer(const char *filename, undo_type action, bool marked,
const char *operation); const char *operation);
#endif #endif
void set_modified(void);
void prepare_for_display(void); void prepare_for_display(void);
#ifdef ENABLE_MULTIBUFFER #ifdef ENABLE_MULTIBUFFER
void mention_name_and_linecount(void); void mention_name_and_linecount(void);
@ -307,7 +307,6 @@ bool outside_of_confinement(const char *currpath, bool allow_tabcomp);
#endif #endif
#ifndef NANO_TINY #ifndef NANO_TINY
void init_backup_dir(void); void init_backup_dir(void);
int write_lockfile(const char *lockfilename, const char *filename, bool modified);
#endif #endif
int copy_file(FILE *inn, FILE *out, bool close_out); int copy_file(FILE *inn, FILE *out, bool close_out);
bool write_file(const char *name, FILE *f_open, bool tmp, bool write_file(const char *name, FILE *f_open, bool tmp,