mirror of
git://git.sv.gnu.org/nano.git
synced 2024-11-23 13:19:43 +03:00
tweaks: close a buffer differently and elide a parameter
This commit is contained in:
parent
3a65c0d192
commit
c5d157dd9d
10
src/files.c
10
src/files.c
@ -462,8 +462,7 @@ bool open_buffer(const char *filename, bool new_buffer)
|
||||
/* When not overriding an existing lock, discard the buffer. */
|
||||
if (do_lockfile(realname) < 0) {
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
openfile = openfile->prev;
|
||||
close_buffer(openfile->next);
|
||||
close_buffer();
|
||||
#endif
|
||||
free(realname);
|
||||
return FALSE;
|
||||
@ -645,10 +644,11 @@ void switch_to_next_buffer(void)
|
||||
switch_to_adjacent_buffer(FORWARD);
|
||||
}
|
||||
|
||||
/* Remove the given buffer from the circular list of buffers. */
|
||||
void close_buffer(openfilestruct *buffer)
|
||||
/* Remove the current buffer from the circular list of buffers. */
|
||||
void close_buffer(void)
|
||||
{
|
||||
unlink_opennode(buffer);
|
||||
openfile = openfile->prev;
|
||||
unlink_opennode(openfile->next);
|
||||
|
||||
/* When just one buffer remains open, show "Exit" in the help lines. */
|
||||
if (openfile == openfile->next)
|
||||
|
@ -223,9 +223,8 @@ void do_help(void)
|
||||
}
|
||||
}
|
||||
|
||||
/* Switch back to the original buffer and discard the help-text buffer. */
|
||||
openfile = openfile->prev;
|
||||
close_buffer(openfile->next);
|
||||
/* Discard the help-text buffer. */
|
||||
close_buffer();
|
||||
|
||||
/* Restore the settings of all flags. */
|
||||
memcpy(flags, stash, sizeof(flags));
|
||||
|
@ -1044,7 +1044,9 @@ void close_and_go(void)
|
||||
openfile->current->lineno, xplustabs() + 1);
|
||||
#endif
|
||||
switch_to_next_buffer();
|
||||
close_buffer(openfile->prev);
|
||||
openfile = openfile->prev;
|
||||
close_buffer();
|
||||
openfile = openfile->next;
|
||||
/* Adjust the count in the top bar. */
|
||||
titlebar(NULL);
|
||||
} else
|
||||
|
@ -276,7 +276,7 @@ void prepare_for_display(void);
|
||||
void mention_name_and_linecount(void);
|
||||
void switch_to_prev_buffer(void);
|
||||
void switch_to_next_buffer(void);
|
||||
void close_buffer(openfilestruct *buffer);
|
||||
void close_buffer(void);
|
||||
#endif
|
||||
void read_file(FILE *f, int fd, const char *filename, bool undoable);
|
||||
int open_file(const char *filename, bool newfie, FILE **f);
|
||||
|
@ -3374,8 +3374,7 @@ void total_refresh(void)
|
||||
titlebar(title);
|
||||
#ifdef ENABLE_HELP
|
||||
if (inhelp) {
|
||||
openfile = openfile->prev;
|
||||
close_buffer(openfile->next);
|
||||
close_buffer();
|
||||
wrap_help_text_into_buffer();
|
||||
} else
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user