diff options
| author | Kyren223 <Kyren223@proton.me> | 2025-01-19 18:07:25 +0200 |
|---|---|---|
| committer | Kyren223 <Kyren223@proton.me> | 2025-01-19 18:07:25 +0200 |
| commit | 7c4a45f41316886a99d8a9ae1d4d2b88e4f0455e (patch) | |
| tree | 8a754347d8cdc577751ddb1913f723d4c51a4f45 /internal/client/ui/viminput | |
| parent | 1b3b74464b373b412d256d58f5c511c64278a425 (diff) | |
Made UI more responsive
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() { |
