diff options
| author | adamdottv <[email protected]> | 2025-06-04 09:20:42 -0500 |
|---|---|---|
| committer | adamdottv <[email protected]> | 2025-06-04 09:20:48 -0500 |
| commit | 01050a430f03d479387fdd77816211f5312164af (patch) | |
| tree | 69c1319d8722ce6d0a774234b9528e270dd23400 /packages/tui/internal/util | |
| parent | 0b565b18c48cb2bc6423662b08b8fed14a0cc738 (diff) | |
| download | opencode-01050a430f03d479387fdd77816211f5312164af.tar.gz opencode-01050a430f03d479387fdd77816211f5312164af.zip | |
wip: refactoring tui
Diffstat (limited to 'packages/tui/internal/util')
| -rw-r--r-- | packages/tui/internal/util/util.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/packages/tui/internal/util/util.go b/packages/tui/internal/util/util.go new file mode 100644 index 000000000..207382d1e --- /dev/null +++ b/packages/tui/internal/util/util.go @@ -0,0 +1,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)) +} |
