File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44 "strings"
55
66 tea "github.com/charmbracelet/bubbletea"
7- "github.com/charmbracelet/lipgloss"
87
98 "github.com/trufflesecurity/trufflehog/v3/pkg/tui/theme"
109)
@@ -90,7 +89,8 @@ func (c *CheckboxField) View() string {
9089 b .WriteString (" " + styles .Hint .Render (c .spec .Help ))
9190 b .WriteString ("\n " )
9291 }
93- return lipgloss .NewStyle ().MarginBottom (1 ).Render (b .String ())
92+ b .WriteString ("\n " )
93+ return b .String ()
9494}
9595
9696// Error returns the most recent validation error.
Original file line number Diff line number Diff line change 44 "strings"
55
66 tea "github.com/charmbracelet/bubbletea"
7- "github.com/charmbracelet/lipgloss"
87
98 "github.com/trufflesecurity/trufflehog/v3/pkg/tui/theme"
109)
@@ -115,7 +114,8 @@ func (s *SelectField) View() string {
115114 b .WriteString (styles .Hint .Render (s .spec .Help ))
116115 b .WriteString ("\n " )
117116 }
118- return lipgloss .NewStyle ().MarginBottom (1 ).Render (b .String ())
117+ b .WriteString ("\n " )
118+ return b .String ()
119119}
120120
121121// Error returns the most recent validation error.
Original file line number Diff line number Diff line change 55
66 "github.com/charmbracelet/bubbles/textinput"
77 tea "github.com/charmbracelet/bubbletea"
8- "github.com/charmbracelet/lipgloss"
98
109 "github.com/trufflesecurity/trufflehog/v3/pkg/tui/theme"
1110)
@@ -84,7 +83,8 @@ func (t *TextField) View() string {
8483 b .WriteString (styles .Hint .Render (t .spec .Help ))
8584 b .WriteString ("\n " )
8685 }
87- return lipgloss .NewStyle ().MarginBottom (1 ).Render (b .String ())
86+ b .WriteString ("\n " )
87+ return b .String ()
8888}
8989
9090// Error returns the most recent validation error message.
@@ -102,11 +102,18 @@ func (t *TextField) Validate() error {
102102 return nil
103103}
104104
105- // SetWidth hints the input width.
105+ // SetWidth hints the input width. bubbles/textinput pads the value with
106+ // trailing spaces up to Width, so we cap it to avoid painting hundreds of
107+ // columns of padding on wide terminals while still leaving headroom under
108+ // the content area on narrower ones.
106109func (t * TextField ) SetWidth (w int ) {
107110 t .width = w
108- t .input .Width = w - 4
109- if t .input .Width < 10 {
110- t .input .Width = 10
111+ width := w - 6
112+ if width > 80 {
113+ width = 80
114+ }
115+ if width < 10 {
116+ width = 10
111117 }
118+ t .input .Width = width
112119}
You can’t perform that action at this time.
0 commit comments