aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2022-09-11 21:47:24 +0200
committerPřemysl Eric Janouch <p@janouch.name>2022-09-11 21:50:09 +0200
commitb4ee523628b5e91ec06c6c8c61fe03507e1f412e (patch)
tree7624a9678da187a1ee22af81bab15279c6e0e12e
parentc3a52b9e4cd346cf7b8964a69105fdcd30c4ec05 (diff)
downloadxK-b4ee523628b5e91ec06c6c8c61fe03507e1f412e.tar.gz
xK-b4ee523628b5e91ec06c6c8c61fe03507e1f412e.tar.xz
xK-b4ee523628b5e91ec06c6c8c61fe03507e1f412e.zip
xP: bind buffer iteration to M-PageUp/PageDown
-rw-r--r--xP/public/xP.js25
1 files 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
}