diff options
Diffstat (limited to 'internal/client/ui/viminput')
| -rw-r--r-- | internal/client/ui/viminput/viminput.go | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/internal/client/ui/viminput/viminput.go b/internal/client/ui/viminput/viminput.go index 6bc66d1..89f0d8d 100644 --- a/internal/client/ui/viminput/viminput.go +++ b/internal/client/ui/viminput/viminput.go @@ -72,7 +72,7 @@ type Model struct { offset int } -func New(width, maxHeight int) Model { +func New() Model { return Model{ PlaceholderStyle: lipgloss.NewStyle(), PromptStyle: lipgloss.NewStyle(), @@ -97,9 +97,9 @@ func New(width, maxHeight int) Model { amod: false, inactive: false, focus: false, - width: width, + width: -1, height: 1, - maxHeight: maxHeight, + maxHeight: -1, offset: 0, } } @@ -332,16 +332,9 @@ func (m *Model) SetWidth(width int) { m.width = width } -func (m Model) Width() int { - return m.width -} - -func (m *Model) SetHeight(height int) { - m.height = height -} - -func (m Model) Height() int { - return m.height +func (m *Model) SetMaxHeight(maxHeight int) { + m.maxHeight = maxHeight + m.height = min(m.height, m.maxHeight) } func (m *Model) Focus() { |
