Change summary
internal/ui/dialog/api_key_input.go | 2 +-
internal/ui/dialog/commands.go | 2 +-
internal/ui/dialog/models.go | 2 +-
internal/ui/dialog/sessions.go | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
Detailed changes
@@ -71,7 +71,7 @@ func NewAPIKeyInput(com *common.Common, provider catwalk.Provider, model config.
m.input.Placeholder = "Enter you API key..."
m.input.SetStyles(com.Styles.TextInput)
m.input.Focus()
- m.input.SetWidth(innerWidth - t.Dialog.InputPrompt.GetHorizontalFrameSize() - 1) // (1) cursor padding
+ m.input.SetWidth(max(0, innerWidth-t.Dialog.InputPrompt.GetHorizontalFrameSize()-1)) // (1) cursor padding
m.spinner = spinner.New(
spinner.WithSpinner(spinner.Dot),
@@ -256,7 +256,7 @@ func (c *Commands) Draw(scr uv.Screen, area uv.Rectangle) *tea.Cursor {
t.Dialog.HelpView.GetVerticalFrameSize() +
t.Dialog.View.GetVerticalFrameSize()
- c.input.SetWidth(innerWidth - t.Dialog.InputPrompt.GetHorizontalFrameSize() - 1) // (1) cursor padding
+ c.input.SetWidth(max(0, innerWidth-t.Dialog.InputPrompt.GetHorizontalFrameSize()-1)) // (1) cursor padding
c.list.SetSize(innerWidth, height-heightOffset)
c.help.SetWidth(innerWidth)
@@ -251,7 +251,7 @@ func (m *Models) Draw(scr uv.Screen, area uv.Rectangle) *tea.Cursor {
t.Dialog.InputPrompt.GetVerticalFrameSize() + inputContentHeight +
t.Dialog.HelpView.GetVerticalFrameSize() +
t.Dialog.View.GetVerticalFrameSize()
- m.input.SetWidth(innerWidth - t.Dialog.InputPrompt.GetHorizontalFrameSize() - 1) // (1) cursor padding
+ m.input.SetWidth(max(0, innerWidth-t.Dialog.InputPrompt.GetHorizontalFrameSize()-1)) // (1) cursor padding
m.list.SetSize(innerWidth, height-heightOffset)
m.help.SetWidth(innerWidth)
@@ -148,7 +148,7 @@ func (s *Session) Draw(scr uv.Screen, area uv.Rectangle) *tea.Cursor {
t.Dialog.InputPrompt.GetVerticalFrameSize() + inputContentHeight +
t.Dialog.HelpView.GetVerticalFrameSize() +
t.Dialog.View.GetVerticalFrameSize()
- s.input.SetWidth(innerWidth - t.Dialog.InputPrompt.GetHorizontalFrameSize() - 1) // (1) cursor padding
+ s.input.SetWidth(max(0, innerWidth-t.Dialog.InputPrompt.GetHorizontalFrameSize()-1)) // (1) cursor padding
s.list.SetSize(innerWidth, height-heightOffset)
s.help.SetWidth(innerWidth)