我正在使用https://github.com/chjj/blessed并具有以下代码:
navList.on('focus', function() {
navList.style.border.fg = 'green';
screen.render();
});
navList.on('blur', function() {
navList.style.border.fg = 'white';
screen.render();
});
detailBox.on('focus', function() {
detailBox.style.border.fg = 'green';
screen.render();
});
detailBox.on('blur', function() {
detailBox.style.border.fg = 'white';
screen.render();
});
在我添加screen.render()
之前,边框颜色的变化要等到下一次重绘时才会显示,通常在用户按下某个键或单击其他位置时发生。
该代码有效,但是screen.render()
是显示边框颜色变化的最佳方法吗?