From d51b3da1b409525a5e5755871fc6371af0dbf6cc Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Mon, 23 Dec 2024 13:18:30 -0500 Subject: [PATCH] ssb: Fix channel cycling key shortcut. --- apps/ssb/tf-app.js | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/apps/ssb/tf-app.js b/apps/ssb/tf-app.js index b6d62e87a..b1d7a2793 100644 --- a/apps/ssb/tf-app.js +++ b/apps/ssb/tf-app.js @@ -112,26 +112,24 @@ class TfElement extends LitElement { keydown(event) { if (event.altKey && event.key == 'ArrowUp') { - this.next_channel(1); + this.next_channel(-1); event.preventDefault(); } else if (event.altKey && event.key == 'ArrowDown') { - this.next_channel(-1); + this.next_channel(1); event.preventDefault(); } } next_channel(delta) { - let channel_names = ['', '@'].concat(this.channels); + let channel_names = ['', '@', '🔐', ...this.channels.map(x => '#' + x)]; let index = channel_names.indexOf(this.hash.substring(1)); - if (index != -1) { - index += delta; - this.set_hash( - '#' + - encodeURIComponent( - channel_names[(index + channel_names.length) % channel_names.length] - ) - ); - } + index = index != -1 ? index + delta : 0; + tfrpc.rpc.setHash( + '#' + + encodeURIComponent( + channel_names[(index + channel_names.length) % channel_names.length] + ) + ); } set_hash(hash) {