gizak / termui

Golang terminal dashboard
MIT License
13.11k stars 786 forks source link

Is it possible to integrate termui with go-ncurses? #173

Closed miguelmota closed 6 years ago

miguelmota commented 6 years ago

Hi I have a dumb question, is it possible for a termui component, such as the chart, to be rendered inside a ncurses window?

cjbassi commented 6 years ago

Yah it should work, but you would have to make a custom solution by copying over the appropriate files/code to your project, namely the chart, Block, and Buffer files and anything else needed by them.

The way widgets work is that they are internally rendered to a Buffer object, so you could create a chart, get the Buffer object it renders to, and then render that to go-ncurses however it lets you. A Buffer is a struct with an area and a mapping from points in the area to Cells. Cells hold the character of that given point along with color properties.

miguelmota commented 6 years ago

@cjbassi in the end I didn't use ncurses, however what you described is exactly how I went about it. Thanks for the response