mirror of
https://github.com/anotherhadi/ilovetui.git
synced 2026-08-21 03:55:48 +02:00
5f99fa7521
Signed-off-by: Hadi <112569860+anotherhadi@users.noreply.github.com>
14 lines
405 B
Go
14 lines
405 B
Go
package bubbles
|
|
|
|
import "strings"
|
|
|
|
// SplitH splits totalHeight into top and bottom sections, accounting for the
|
|
// height of statusBar (measured by newline count).
|
|
func SplitH(totalHeight int, statusBar string, ratio float64) (top, bottom int) {
|
|
statusH := strings.Count(statusBar, "\n") + 1
|
|
available := totalHeight - statusH
|
|
top = int(float64(available) * ratio)
|
|
bottom = available - top
|
|
return
|
|
}
|