feat: Add border text functions for top and bottom borders.#384
feat: Add border text functions for top and bottom borders.#384pachecot wants to merge 14 commits intocharmbracelet:masterfrom
Conversation
this adds callback functions to set text in borders when they are generated.
…r text
changed internals to use interface{} so will work with string or String().
border length was not being checked before, now it is limited to the width of the border.
|
made some changes to names and api so will accept strings and func() string. here is sample.. |
|
Very nice! We had originally resigned to not including this sort of functionality, but your implementation looks really good. A couple open questions:
Can you also fix the issues pointed out with the linter? |
|
thanks, I will address the issues in the linter. It looks like a bug. It is intended to limit to the length of the box truncating the texts. Currently, it is first come first served, Left -> Center -> Right. so it is unfair and some may not even be included. I would like to change it to a more fair truncating, where they all get some of the space. Currently they could collide. that will need to be addressed. |
|
Made some changes to equalize the sizes some and provide space between the labels. Currently does not add ellipsis, may want to add them. |
Position was not specific enough, could not distinguish between Top and Left, so could not use for side borders. BorderSide currently enum, could possibly be a flag.
|
This would be really helpful. Is there any intention to merge this? |


This allows to set titles and status information in the borders.
This solves the issue where I keep trying to add some status information to the bottom of a border. I either need to take it apart and rebuild it with the additional information or create my own bottom border. This also allows setting some title information, which is nice too.
this still need some error checking if someone returns longer strings.
Example..
will allow to set functions for each corner