summaryrefslogtreecommitdiffhomepage
path: root/packages/tui/internal/util/util.go
blob: 207382d1e04dbcb0df9ec7d4cd7020be13aa8518 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
package util

import (
	tea "github.com/charmbracelet/bubbletea"
)

func CmdHandler(msg tea.Msg) tea.Cmd {
	return func() tea.Msg {
		return msg
	}
}

func Clamp(v, low, high int) int {
	if high < low {
		low, high = high, low
	}
	return min(high, max(low, v))
}