xP: adjust buffer list iteration and styling
M-a and M-! should iterate, rather than keep jumping back to the same buffers. The current item wasn't visible enough, and it jumped around in my 1.5-scale Firefox.
This commit is contained in:
parent
a61789637a
commit
a551e911ab
@ -56,7 +56,7 @@ button {
|
|||||||
|
|
||||||
.list {
|
.list {
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
border-right: 1px solid #ccc;
|
border-right: 2px solid #ccc;
|
||||||
min-width: 10em;
|
min-width: 10em;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
@ -72,11 +72,7 @@ button {
|
|||||||
}
|
}
|
||||||
.item.current {
|
.item.current {
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
background: #f8f8f8;
|
background: #eee;
|
||||||
border-top: 1px solid #eee;
|
|
||||||
border-bottom: 1px solid #eee;
|
|
||||||
margin-top: -1px;
|
|
||||||
margin-bottom: -1px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Only Firefox currently supports align-content: safe end, thus this. */
|
/* Only Firefox currently supports align-content: safe end, thus this. */
|
||||||
|
@ -841,21 +841,25 @@ document.addEventListener('keydown', event => {
|
|||||||
if (rpc.ws == undefined || !hasShortcutModifiers(event))
|
if (rpc.ws == undefined || !hasShortcutModifiers(event))
|
||||||
return
|
return
|
||||||
|
|
||||||
let names = undefined
|
// Rotate names so that the current buffer comes first.
|
||||||
|
let names = [...buffers.keys()]
|
||||||
|
names.push.apply(names,
|
||||||
|
names.splice(0, names.findIndex(name => name == bufferCurrent)))
|
||||||
|
|
||||||
switch (event.key) {
|
switch (event.key) {
|
||||||
case 'h':
|
case 'h':
|
||||||
bufferToggleLog()
|
bufferToggleLog()
|
||||||
break
|
break
|
||||||
case 'a':
|
case 'a':
|
||||||
for (const [name, b] of buffers)
|
for (const name of names.slice(1))
|
||||||
if (name !== bufferCurrent && b.newMessages) {
|
if (buffers.get(name).newMessages) {
|
||||||
bufferActivate(name)
|
bufferActivate(name)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
case '!':
|
case '!':
|
||||||
for (const [name, b] of buffers)
|
for (const name of names.slice(1))
|
||||||
if (name !== bufferCurrent && b.highlighted) {
|
if (buffers.get(name).highlighted) {
|
||||||
bufferActivate(name)
|
bufferActivate(name)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@ -865,20 +869,12 @@ document.addEventListener('keydown', event => {
|
|||||||
bufferActivate(bufferLast)
|
bufferActivate(bufferLast)
|
||||||
break
|
break
|
||||||
case 'PageUp':
|
case 'PageUp':
|
||||||
names = [...buffers.keys()]
|
if (names.length > 1)
|
||||||
for (let i = 0; i < names.length; i++)
|
bufferActivate(names.at(-1))
|
||||||
if (names[i] === bufferCurrent) {
|
|
||||||
bufferActivate(names.at(--i))
|
|
||||||
break
|
|
||||||
}
|
|
||||||
break
|
break
|
||||||
case 'PageDown':
|
case 'PageDown':
|
||||||
names = [...buffers.keys()]
|
if (names.length > 1)
|
||||||
for (let i = 0; i < names.length; i++)
|
bufferActivate(names.at(+1))
|
||||||
if (names[i] === bufferCurrent) {
|
|
||||||
bufferActivate(names.at(++i) || names[0])
|
|
||||||
break
|
|
||||||
}
|
|
||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user