mirror of
https://git.sr.ht/~emersion/gamja
synced 2024-12-02 04:17:09 -05:00
Fallback to first server buffer in Alt+a keybind
Previously we switched to the server buffer for the current network.
This commit is contained in:
parent
ab11af3965
commit
e76e71c968
1 changed files with 12 additions and 3 deletions
|
@ -1,4 +1,4 @@
|
||||||
import { ReceiptType, Unread, SERVER_BUFFER } from "./state.js";
|
import { ReceiptType, Unread, BufferType, SERVER_BUFFER } from "./state.js";
|
||||||
|
|
||||||
export const keybindings = [
|
export const keybindings = [
|
||||||
{
|
{
|
||||||
|
@ -28,14 +28,23 @@ export const keybindings = [
|
||||||
description: "Jump to next buffer with activity",
|
description: "Jump to next buffer with activity",
|
||||||
execute: (app) => {
|
execute: (app) => {
|
||||||
// TODO: order by priority, then by age
|
// 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()) {
|
for (var buf of app.state.buffers.values()) {
|
||||||
|
if (!firstServerBuffer && buf.type === BufferType.SERVER) {
|
||||||
|
firstServerBuffer = buf;
|
||||||
|
}
|
||||||
if (buf.unread != Unread.NONE) {
|
if (buf.unread != Unread.NONE) {
|
||||||
target = buf;
|
target = buf;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
app.switchBuffer(target);
|
if (!target) {
|
||||||
|
target = firstServerBuffer;
|
||||||
|
}
|
||||||
|
if (target) {
|
||||||
|
app.switchBuffer(target);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue