i am trying to make a chatroom app with blessed, here is my code: index.js
const blessed = require('blessed')
const EventEmitter = require('events')
// Create a eventemitter
var chatroom = new EventEmitter()
// Create a screen object.
var screen = blessed.screen({smartCSR: true, dockBorders: true})
screen.title = 'chatroom'
screen.key(['C-c', 'escape'], () => { // exit
return process.exit(0)
})
var chatarea = blessed.box({
parent: screen,
top: 0,
title: 'chatroom',
width: '100%',
height: '100%-2',
tags: true,
border: {
type: 'line'
},
style: {
fg: 'white',
}
})
var form = blessed.form({
parent: screen,
bottom: 0,
width: '100%',
height: 3,
keys: true,
border: {
type: 'line'
}
})
var input = blessed.textarea({
parent: screen,
bottom: 1,
left: 1,
width: '100%',
height: 1,
input: true,
focused: true,
inputOnFocus: true,
tags: true,
});
input.focus()
screen.append(chatarea)
screen.append(form)
screen.append(input)
screen.render()
but it always repeat all the key i am typing, for example: if i type 'hello', it will show hheelllloo like this:
it will repeat all the chars, how can i fix this? thx