From 064102b786a1fdd29b2300f56d684e59718ecb53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=99emysl=20Eric=20Janouch?=
Date: Sun, 9 Aug 2026 15:19:28 +0200 Subject: [PATCH] xF: simplify action code --- xF.c | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/xF.c b/xF.c index 69450e4..3da5b10 100644 --- a/xF.c +++ b/xF.c @@ -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)