I'm using the Blessed library to make a dashboard in the terminal.
I'm logging things into a log widget, and would like to make the widget scrollable. With the below code, the scrollbar is appearing, but I can't actually scroll using my mouse wheel, or by dragging the scroll bar.
var logPanel = blessed.log({
top: '0',
left: '0',
width: '60%',
height: '100%',
tags: true,
border: {
type: 'line'
},
scrollable: true,
alwaysScroll: true,
scrollbar: {
ch: ' ',
inverse: true
},
style: {
fg: 'green',
bg: 'black',
border: {
fg: '#f0f0f0'
}
}
});
How can I get the scroll working?
According to Blessed's documentation, there are three ways to scroll that you can enable by setting corresponding properties to true
in your options
object:
keys
option [j/k keys](as found in the deprecated ScrollableBox, but applicable to a plain box too)
I had some trouble figuring this out myself from the docs. I guess sometimes if there's a lot of text it doesn't means it's good.
Another problem that you might encounter if that once a box overflows with text, it doesn't scrolls automatically. You need to enable that yourself by calling setScrollPerc(100)
function on you Box object right after you add a new line.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With