1
1

tweaks: elide another parameter, and rename the function to match

Этот коммит содержится в:
Benno Schulenberg 2019-05-31 09:33:28 +02:00
родитель c5d157dd9d
Коммит 122cabd3ba

Просмотреть файл

@ -598,19 +598,15 @@ void mention_name_and_linecount(void)
_("New Buffer") : tail(openfile->filename), count); _("New Buffer") : tail(openfile->filename), count);
} }
/* Switch to a neighbouring file buffer; to the next if to_next is TRUE; /* Update title bar and such after switching to another buffer.*/
* otherwise, to the previous one. */ void redecorate_after_switch(void)
void switch_to_adjacent_buffer(bool to_next)
{ {
/* If only one file buffer is open, say so and get out. */ /* If only one file buffer is open, there is nothing to update. */
if (openfile == openfile->next) { if (openfile == openfile->next) {
statusbar(_("No more open file buffers")); statusbar(_("No more open file buffers"));
return; return;
} }
/* Switch to the next or previous file buffer. */
openfile = to_next ? openfile->next : openfile->prev;
#ifndef NANO_TINY #ifndef NANO_TINY
/* When not in softwrap mode, make sure firstcolumn is zero. It might /* When not in softwrap mode, make sure firstcolumn is zero. It might
* be nonzero if we had softwrap mode on while in this buffer, and then * be nonzero if we had softwrap mode on while in this buffer, and then
@ -635,13 +631,15 @@ void switch_to_adjacent_buffer(bool to_next)
/* Switch to the previous entry in the list of open files. */ /* Switch to the previous entry in the list of open files. */
void switch_to_prev_buffer(void) void switch_to_prev_buffer(void)
{ {
switch_to_adjacent_buffer(BACKWARD); openfile = openfile->prev;
redecorate_after_switch();
} }
/* Switch to the next entry in the list of open files. */ /* Switch to the next entry in the list of open files. */
void switch_to_next_buffer(void) void switch_to_next_buffer(void)
{ {
switch_to_adjacent_buffer(FORWARD); openfile = openfile->next;
redecorate_after_switch();
} }
/* Remove the current buffer from the circular list of buffers. */ /* Remove the current buffer from the circular list of buffers. */