gizak / termui

Golang terminal dashboard
MIT License
13.14k stars 787 forks source link

Decoupled interface from values for fluid redraw on resize #33

Closed NHOrus closed 9 years ago

NHOrus commented 9 years ago

goes into gizak/termui#32 , but does not fix the bug, just prettifies visuals of demo

gizak commented 9 years ago

The bug comes from the fact that

If x = a + b + c + ...
then int(a) + int(b) + int(c) + ... <= x

Grid currently works as following:

1. get the current available width
2. calculate its components' width (float)
3. assign a width to each components (int) based on their span

When Grid divided area into parts then put it together, there will be a loss of precision since we take the floor of each components width.

This will be addressed later since I am working on refactoring, but any help would be greatly appreciated :)