From e76e71c96844e962ef8575d730d2a27d8c55590e Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Mon, 31 May 2021 13:24:23 +0200 Subject: [PATCH] Fallback to first server buffer in Alt+a keybind Previously we switched to the server buffer for the current network. --- keybindings.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/keybindings.js b/keybindings.js index 4f1b46a..ac1b634 100644 --- a/keybindings.js +++ b/keybindings.js @@ -1,4 +1,4 @@ -import { ReceiptType, Unread, SERVER_BUFFER } from "./state.js"; +import { ReceiptType, Unread, BufferType, SERVER_BUFFER } from "./state.js"; export const keybindings = [ { @@ -28,14 +28,23 @@ export const keybindings = [ description: "Jump to next buffer with activity", execute: (app) => { // TODO: order by priority, then by age - var target = { name: SERVER_BUFFER }; + var firstServerBuffer = null; + var target = null; for (var buf of app.state.buffers.values()) { + if (!firstServerBuffer && buf.type === BufferType.SERVER) { + firstServerBuffer = buf; + } if (buf.unread != Unread.NONE) { target = buf; break; } } - app.switchBuffer(target); + if (!target) { + target = firstServerBuffer; + } + if (target) { + app.switchBuffer(target); + } }, }, {