tweaks: close a buffer differently and elide a parameter
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. */
|
/* When not overriding an existing lock, discard the buffer. */
|
||||||
if (do_lockfile(realname) < 0) {
|
if (do_lockfile(realname) < 0) {
|
||||||
#ifdef ENABLE_MULTIBUFFER
|
#ifdef ENABLE_MULTIBUFFER
|
||||||
openfile = openfile->prev;
|
close_buffer();
|
||||||
close_buffer(openfile->next);
|
|
||||||
#endif
|
#endif
|
||||||
free(realname);
|
free(realname);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -645,10 +644,11 @@ void switch_to_next_buffer(void)
|
||||||
switch_to_adjacent_buffer(FORWARD);
|
switch_to_adjacent_buffer(FORWARD);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Remove the given buffer from the circular list of buffers. */
|
/* Remove the current buffer from the circular list of buffers. */
|
||||||
void close_buffer(openfilestruct *buffer)
|
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. */
|
/* When just one buffer remains open, show "Exit" in the help lines. */
|
||||||
if (openfile == openfile->next)
|
if (openfile == openfile->next)
|
||||||
|
|
|
@ -223,9 +223,8 @@ void do_help(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Switch back to the original buffer and discard the help-text buffer. */
|
/* Discard the help-text buffer. */
|
||||||
openfile = openfile->prev;
|
close_buffer();
|
||||||
close_buffer(openfile->next);
|
|
||||||
|
|
||||||
/* Restore the settings of all flags. */
|
/* Restore the settings of all flags. */
|
||||||
memcpy(flags, stash, sizeof(flags));
|
memcpy(flags, stash, sizeof(flags));
|
||||||
|
|
|
@ -1044,7 +1044,9 @@ void close_and_go(void)
|
||||||
openfile->current->lineno, xplustabs() + 1);
|
openfile->current->lineno, xplustabs() + 1);
|
||||||
#endif
|
#endif
|
||||||
switch_to_next_buffer();
|
switch_to_next_buffer();
|
||||||
close_buffer(openfile->prev);
|
openfile = openfile->prev;
|
||||||
|
close_buffer();
|
||||||
|
openfile = openfile->next;
|
||||||
/* Adjust the count in the top bar. */
|
/* Adjust the count in the top bar. */
|
||||||
titlebar(NULL);
|
titlebar(NULL);
|
||||||
} else
|
} else
|
||||||
|
|
|
@ -276,7 +276,7 @@ void prepare_for_display(void);
|
||||||
void mention_name_and_linecount(void);
|
void mention_name_and_linecount(void);
|
||||||
void switch_to_prev_buffer(void);
|
void switch_to_prev_buffer(void);
|
||||||
void switch_to_next_buffer(void);
|
void switch_to_next_buffer(void);
|
||||||
void close_buffer(openfilestruct *buffer);
|
void close_buffer(void);
|
||||||
#endif
|
#endif
|
||||||
void read_file(FILE *f, int fd, const char *filename, bool undoable);
|
void read_file(FILE *f, int fd, const char *filename, bool undoable);
|
||||||
int open_file(const char *filename, bool newfie, FILE **f);
|
int open_file(const char *filename, bool newfie, FILE **f);
|
||||||
|
|
|
@ -3374,8 +3374,7 @@ void total_refresh(void)
|
||||||
titlebar(title);
|
titlebar(title);
|
||||||
#ifdef ENABLE_HELP
|
#ifdef ENABLE_HELP
|
||||||
if (inhelp) {
|
if (inhelp) {
|
||||||
openfile = openfile->prev;
|
close_buffer();
|
||||||
close_buffer(openfile->next);
|
|
||||||
wrap_help_text_into_buffer();
|
wrap_help_text_into_buffer();
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue