xF: simplify action code
Alpine 3.24 Success
Arch Linux AUR Success
OpenBSD 7.8 Success

This commit is contained in:
2026-08-09 15:19:28 +02:00
parent 621f76c797
commit 064102b786
+4 -18
View File
@@ -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)