Adding the ability to use ESC to enter scroll mode, ESC twice to exit and T or ENTER to return to chat

This commit is contained in:
raven 2023-01-15 22:01:49 -05:00
parent cc3f62dfbf
commit 7d3ab3e2ee

View File

@ -52,6 +52,12 @@ const screen = blessed.screen({
fastCSR: true
});
// Debug ONLY
// screen.on('keypress', function(ch, key){
// console.log(JSON.stringify(key));
// });
let mainBox = blessed.box({
parent: screen,
top: 0,
@ -310,5 +316,22 @@ screen.render()
// Quit on Escape, q, or Control-C.
screen.key(['escape', 'q', 'C-c'], function (ch, key) {
return process.exit(0);
console.log("Sending close message...")
for (let conn of conns) {
conn.write(`CLOSED: ${publicKey.toString('hex')}`)
}
(async () => {
await sleep(2000)
process.exit()
})();
});
let scrollCount = 0
// Return to chat
screen.key(['t', 'enter'], function (ch, key) {
stdinBox.focus();
});