[GH-ISSUE #213] Can I have a row as tall as one character? #115

Closed
opened 2026-03-03 16:22:30 +03:00 by kerem · 5 comments
Owner

Originally created by @fenollp on GitHub (May 23, 2019).
Original GitHub issue: https://github.com/mum4k/termdash/issues/213

Originally assigned to: @mum4k on GitHub.

I have adapted the demo to use this layout:

func contLayout(w *widgets) ([]container.Option, error) {
        builder := grid.New()
        builder.Add(
                grid.RowHeightPerc(94, grid.Widget(w.rollT)),
                grid.RowHeightPerc(3, grid.Widget(w.gauge)),
                grid.RowHeightPerc(3, grid.Widget(w.gauge)),
        )
        return builder.Build()

I'm trying to get the bottom 2 gauges to always be as tall as a the XX% progress they contain (= as tall as a character).
But when I change my terminal zoom this eventually ends as text smaller than the bar and no longer vertically centered.

Any plans on adding something akin to grid.RowHeightEM (from CSS: https://www.w3schools.com/cssref/css_units.asp)

Originally created by @fenollp on GitHub (May 23, 2019). Original GitHub issue: https://github.com/mum4k/termdash/issues/213 Originally assigned to: @mum4k on GitHub. I have adapted [the demo](https://github.com/mum4k/termdash/blob/b60c1c5fb019886cd945a537586b315831a1c03c/termdashdemo/termdashdemo.go) to use this layout: ```golang func contLayout(w *widgets) ([]container.Option, error) { builder := grid.New() builder.Add( grid.RowHeightPerc(94, grid.Widget(w.rollT)), grid.RowHeightPerc(3, grid.Widget(w.gauge)), grid.RowHeightPerc(3, grid.Widget(w.gauge)), ) return builder.Build() ``` I'm trying to get the bottom 2 gauges to always be as tall as a the XX% progress they contain (= as tall as a character). But when I change my terminal zoom this eventually ends as text smaller than the bar and no longer vertically centered. Any plans on adding something akin to `grid.RowHeightEM` (from CSS: https://www.w3schools.com/cssref/css_units.asp)
kerem 2026-03-03 16:22:30 +03:00
Author
Owner

@mum4k commented on GitHub (May 24, 2019):

Hi @fenollp, thanks for pointing this out. PR #204 recently added support for fixed size container splits. Note this hasn't been released yet and is available in the devel branch only. However the PR added the support only to the binary tree layout. It should be trivial to add this to the grid layout as well. I will try to squeeze this in before the next release.

Do note that Termdash currently only supports a full-screen mode. So even with fixed size splits - the last row (the last container) will always dynamically adjust to the remaining height of the screen. If I understand your use case correctly - this should not be a problem.

<!-- gh-comment-id:495456578 --> @mum4k commented on GitHub (May 24, 2019): Hi @fenollp, thanks for pointing this out. PR #204 recently added support for fixed size container splits. Note this hasn't been released yet and is available in the [devel](https://github.com/mum4k/termdash/tree/devel) branch only. However the PR added the support only to the [binary tree layout](https://github.com/mum4k/termdash/wiki/Binary-tree-layout). It should be trivial to add this to the [grid layout](https://github.com/mum4k/termdash/wiki/Grid-layout) as well. I will try to squeeze this in before the next release. Do note that Termdash currently only supports a full-screen mode. So even with fixed size splits - the last row (the last container) will always dynamically adjust to the remaining height of the screen. If I understand your use case correctly - this should not be a problem.
Author
Owner

@mum4k commented on GitHub (May 24, 2019):

This has now been pushed into the devel branch.

Please give it a try and let me know if you see anything missing.

<!-- gh-comment-id:495468717 --> @mum4k commented on GitHub (May 24, 2019): This has now been pushed into the [devel](https://github.com/mum4k/termdash/tree/devel) branch. Please give it a try and let me know if you see anything missing.
Author
Owner

@fenollp commented on GitHub (May 24, 2019):

It works quite well, as long as I fix the top container height which breaks as soon as I resize the window:

        builder.Add(
                grid.RowHeightFixed(47, grid.Widget(w.rollT)),
                grid.RowHeightFixed(1, grid.Widget(w.gauge)),
                grid.RowHeightFixed(1, grid.Widget(w.gauge)),
        )
<!-- gh-comment-id:495655892 --> @fenollp commented on GitHub (May 24, 2019): It works quite well, as long as I fix the top container height which breaks as soon as I resize the window: ```go builder.Add( grid.RowHeightFixed(47, grid.Widget(w.rollT)), grid.RowHeightFixed(1, grid.Widget(w.gauge)), grid.RowHeightFixed(1, grid.Widget(w.gauge)), ) ```
Author
Owner

@mum4k commented on GitHub (May 24, 2019):

Thanks for coming back @fenollp,

sorry not sure what you mean by "which breaks as soon as I resize the window". Does this mean we still have an issue we should improve on?

<!-- gh-comment-id:495657080 --> @mum4k commented on GitHub (May 24, 2019): Thanks for coming back @fenollp, sorry not sure what you mean by "which breaks as soon as I resize the window". Does this mean we still have an issue we should improve on?
Author
Owner

@fenollp commented on GitHub (May 25, 2019):

Actually yes, now that I'm trying the above code on a different terminal & screen resolution it appears grid.RowHeightFixed(1, grid.Widget(w.gauge)) can take more height than the height of the characters it contains. It is fine on OSX though.

<!-- gh-comment-id:495897878 --> @fenollp commented on GitHub (May 25, 2019): Actually yes, now that I'm trying the above code on a different terminal & screen resolution it appears `grid.RowHeightFixed(1, grid.Widget(w.gauge))` can take more height than the height of the characters it contains. It is fine on OSX though.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/termdash#115
No description provided.