xP: bind buffer iteration to M-PageUp/PageDown

This commit is contained in:
Přemysl Eric Janouch 2022-09-11 21:47:24 +02:00
parent c3a52b9e4c
commit b4ee523628
Signed by: p
GPG Key ID: A0420B94F92B9493
1 changed files with 21 additions and 4 deletions

View File

@ -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
}