blessed-contrib
blessed-contrib copied to clipboard
Add option to remove borders on grid
The grid add a border on all the widgets. Add an option to remove them and only show the lines that separate the cells, it would get a little bit ugly but will allow to get some extra space on too crowd grids used on small screens. Ideally, it should detect complex configurations like the dashboard demo and use the three and four ends like graphics.
This could be similar to the separator lines between widgets like the panels in Eclipse or Atom, that also allow to use the mouse to resize them.
currently the border comes from blessed and is all-or-nothing: there is no concept of a separator between components - there is only the full border.
What would be better, a separator as a new widget of only one column/row, or add the option to the windows to only show a line between them?
or add the option to the windows to only show a line between them
Sorry, I wanted to say the grid :-P
in terms of api this seems a grid concern so users should probably not be aware of new widgets. internally not sure how it is best for the grid to implement it - this would require more delicate calculation of positions and line drawing capabilities from blessed (e.g. infer available characters).
I suspected something like this...
Border docking is now implemented in master and I'm currently working on selective border drawing (border.left = true; border.top = false; etc.).
:thumbsup:
Both border docking and selective borders have been implemented. Border docking/merging works automatically at all angles of every box as long as the borders are the same color. I somehow found a really efficient way to implement it to my surprise. See: https://github.com/chjj/blessed/issues/118#issuecomment-90323945 and https://github.com/chjj/blessed/blob/master/test/widget-dock.js
@yaronn, @piranna, it's been a while. What do you think? I think the dockBorders
option is pretty nice in combination with something like left: '50%-1'
. I think the need for a Separator widget is no longer necessary.
Edited for spelling.
You are right a Separator widget is no longer necessary, only for the use case of click on them and move to resize the grid cells, but maybe now it should be a functionality of the Grid widget itself, isn't it?
I'm not completely familiar with how the grid layout works in blessed-contrib, but blessed now has the Table/ListTable and more importantly the grid Layout option. Both Table and the grid
Layout option provide a very dynamic grid-like border. I'm sure the blessed-contrib Grid operates differently most likely though. In any case, it will automatically work with dockBorders.
Yeah, I know blessed-contrib Grid can work automatically with dockBorders option :-) What I'm asking for instead is about allow to click on the separator row/column between two cells (their border) and when moving the mouse, resize the cells on the Grid.
Ah, I see what you're saying. Yeah, that might be tricky because it depends on which Element you were actually mousing down on, however, it could probably be implemented by cleverly looking at mouse movements and direction for each element in the grid.
Could be the dockBorders functionality abstracted, so the Grid manage directly the mouse events on the cells borders/separators and the cells being border-less windows instead of being the Grid a container for several border-overlapping windows? Maybe this way it's easier to implement... Or maybe also fully split the border from the widget themselves and make them border-less while the borders works as a decorator, similarly (but not equal, obviously) to how window managers work...
I think this should be closed since you can now provide the hideBorder
boolean to remove them.
I know this is old - but I'm not sure the hideBorder option is working right, and this issue is still open.
if (!this.options.hideBorder) options.border = {type: "line", fg: this.options.color || "cyan"}
If I remove 'this' from !this.options.hideBorder, it works like I expect it to (I can pass in hideBorder:true per grid widget).