Closed dcu closed 8 years ago
I'd prefer to keep views as simple as possible, think on them just as buffers. In the case of needing a title, I would add another view above just with the title (one line height, you can disable borders, etc.)
I've implemented this feature based on the PR #36 from @conejoninja. You can check it on branch view-title commit bb01d13a959295e85f4eb6b4bf0cfdec6526252d. The main difference between my patch and the original PR is that I iterate over the title string, avoiding unnecessary iterations during the draw loop.
I've also added an example with all the test cases under _examples/title.go to test long titles, overlap between views, small views with title, etc.
Could you please check if it works as expected? :)
This is the output of _examples/title.go
:
Looks good to me, no problems so far
Great. I've just merged it!
hi,
is there a way to add a title to the view? If not, that'd be nice to have, it can be in the same level as the frame like https://github.com/gizak/termui does.
The syntax could be something like this: