fix(textarea): account for base styling frame when calculating width

This commit is contained in:
Maas Lalani 2022-07-05 14:10:32 -04:00
parent 588393fbf8
commit 2a2fb10f5f

View File

@ -673,6 +673,10 @@ func (m *Model) SetWidth(w int) {
if m.ShowLineNumbers { if m.ShowLineNumbers {
inputWidth -= rw.StringWidth(fmt.Sprintf(m.lineNumberFormat, 0)) inputWidth -= rw.StringWidth(fmt.Sprintf(m.lineNumberFormat, 0))
} }
// Account for base style borders and padding.
inputWidth -= m.style.Base.GetHorizontalFrameSize()
inputWidth -= rw.StringWidth(m.Prompt) inputWidth -= rw.StringWidth(m.Prompt)
m.width = clamp(inputWidth, minWidth, maxWidth) m.width = clamp(inputWidth, minWidth, maxWidth)
} }