diff options
| author | adamdottv <[email protected]> | 2025-06-13 11:18:46 -0500 |
|---|---|---|
| committer | adamdottv <[email protected]> | 2025-06-13 11:18:46 -0500 |
| commit | 61396b93edd8e93ad45503ca785f94314d9cd4b5 (patch) | |
| tree | 91b1db1d11712e212b1ecfa96880a1a3269131ad /packages/tui/internal/layout/container.go | |
| parent | 62b9a30a9c70bd48768055f0049400d27a849c3e (diff) | |
| download | opencode-61396b93edd8e93ad45503ca785f94314d9cd4b5.tar.gz opencode-61396b93edd8e93ad45503ca785f94314d9cd4b5.zip | |
wip: refactoring tui
Diffstat (limited to 'packages/tui/internal/layout/container.go')
| -rw-r--r-- | packages/tui/internal/layout/container.go | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/packages/tui/internal/layout/container.go b/packages/tui/internal/layout/container.go index 3fa844afc..c57b7bd7e 100644 --- a/packages/tui/internal/layout/container.go +++ b/packages/tui/internal/layout/container.go @@ -18,11 +18,14 @@ type Container interface { Blur() MaxWidth() int Alignment() lipgloss.Position + GetPosition() (x, y int) } type container struct { width int height int + x int + y int content ModelWithView @@ -140,7 +143,7 @@ func (c *container) SetSize(width, height int) tea.Cmd { } func (c *container) GetSize() (int, int) { - return c.width, c.height + return min(c.width, c.maxWidth), c.height } func (c *container) MaxWidth() int { @@ -169,6 +172,11 @@ func (c *container) Blur() { } } +// GetPosition returns the x, y coordinates of the container +func (c *container) GetPosition() (x, y int) { + return c.x, c.y +} + type ContainerOption func(*container) func NewContainer(content ModelWithView, options ...ContainerOption) Container { |
