From f9c2f44d2e16455290f38d7c2f3c4c727008b035 Mon Sep 17 00:00:00 2001 From: raven Date: Sun, 15 Jan 2023 22:14:24 -0500 Subject: [PATCH] Adding scrolling for peer list --- sshChat.js | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/sshChat.js b/sshChat.js index b0c62ca..1acb52c 100644 --- a/sshChat.js +++ b/sshChat.js @@ -72,6 +72,12 @@ screen.key(['t', 'enter'], function (ch, key) { stdinBox.focus(); }); +// Return to chat +screen.key(['p', 'enter'], function (ch, key) { + sidebarBox.focus(); +}); + + // Debug ONLY // screen.on('keypress', function(ch, key){ // console.log(JSON.stringify(key)); @@ -126,22 +132,29 @@ const stdinBox = blessed.textbox({ input: true }); -// Create the sidebar box for connected peers -const sidebarBox = blessed.box({ + + +let sidebarBox = blessed.box({ + parent: screen, top: '0', right: '0', width: '20%', height: '100%', - content: '', border: { type: 'line' }, style: { fg: 'white', - bg: 'black', - border: { - fg: '#f0f0f0' - }, + bg: 'black' + }, + keys: true, + vi: true, + alwaysScroll: true, + scrollable: true, + scrollbar: { + style: { + bg: 'yellow' + } } });