From b4ee523628b5e91ec06c6c8c61fe03507e1f412e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=99emysl=20Eric=20Janouch?= Date: Sun, 11 Sep 2022 21:47:24 +0200 Subject: [PATCH] xP: bind buffer iteration to M-PageUp/PageDown --- xP/public/xP.js | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/xP/public/xP.js b/xP/public/xP.js index f80182a..d3b2d16 100644 --- a/xP/public/xP.js +++ b/xP/public/xP.js @@ -817,11 +817,8 @@ document.addEventListener('keydown', event => { if (rpc.ws == undefined || !hasShortcutModifiers(event)) return + let names = undefined switch (event.key) { - case 'Tab': - if (bufferLast !== undefined) - bufferActivate(bufferLast) - break case 'h': bufferToggleLog() break @@ -839,6 +836,26 @@ document.addEventListener('keydown', event => { break } break + case 'Tab': + if (bufferLast !== undefined) + bufferActivate(bufferLast) + break + case 'PageUp': + names = [...buffers.keys()] + for (let i = 0; i < names.length; i++) + if (names[i] === bufferCurrent) { + bufferActivate(names.at(--i)) + break + } + break + case 'PageDown': + names = [...buffers.keys()] + for (let i = 0; i < names.length; i++) + if (names[i] === bufferCurrent) { + bufferActivate(names.at(++i) || names[0]) + break + } + break default: return }