xF: simplify action code
This commit is contained in:
@@ -3360,22 +3360,6 @@ app_toggle_unimportant (void)
|
||||
relay_send (&m, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
app_switch_buffer (int direction)
|
||||
{
|
||||
if (!g.buffers)
|
||||
return;
|
||||
|
||||
struct buffer *next = NULL;
|
||||
if (!g.buffer_current)
|
||||
next = g.buffers;
|
||||
else if (direction > 0)
|
||||
next = g.buffer_current->next ? g.buffer_current->next : g.buffers;
|
||||
else
|
||||
next = g.buffer_current->prev ? g.buffer_current->prev : g.buffers_tail;
|
||||
app_send_buffer_activate (next);
|
||||
}
|
||||
|
||||
static struct buffer *
|
||||
buffer_after (struct buffer *b, bool backwards)
|
||||
{
|
||||
@@ -3835,10 +3819,12 @@ app_process_action (enum action action)
|
||||
return true;
|
||||
|
||||
case ACTION_BUFFER_PREVIOUS:
|
||||
app_switch_buffer (-1);
|
||||
if (g.buffer_current)
|
||||
app_send_buffer_activate (buffer_after (g.buffer_current, true));
|
||||
return true;
|
||||
case ACTION_BUFFER_NEXT:
|
||||
app_switch_buffer (+1);
|
||||
if (g.buffer_current)
|
||||
app_send_buffer_activate (buffer_after (g.buffer_current, false));
|
||||
return true;
|
||||
case ACTION_BUFFER_LAST:
|
||||
if (!g.buffer_last)
|
||||
|
||||
Reference in New Issue
Block a user