fix(textarea): end of buffer alignment

This commit is contained in:
Maas Lalani
2024-02-28 10:57:49 -05:00
parent e985ec9f15
commit c94f0cc151
2 changed files with 31 additions and 31 deletions
+2 -2
View File
@@ -1139,7 +1139,7 @@ func (m Model) View() string {
displayLine++ displayLine++
if m.ShowLineNumbers { if m.ShowLineNumbers {
lineNumber := m.style.EndOfBuffer.Render((fmt.Sprintf(m.lineNumberFormat, string(m.EndOfBufferCharacter)))) lineNumber := m.style.EndOfBuffer.Render(string(m.EndOfBufferCharacter))
s.WriteString(lineNumber) s.WriteString(lineNumber)
} }
s.WriteRune('\n') s.WriteRune('\n')
@@ -1193,7 +1193,7 @@ func (m Model) placeholderView() string {
s.WriteString(prompt) s.WriteString(prompt)
if m.ShowLineNumbers { if m.ShowLineNumbers {
eob := m.style.EndOfBuffer.Render((fmt.Sprintf(m.lineNumberFormat, string(m.EndOfBufferCharacter)))) eob := m.style.EndOfBuffer.Render(string(m.EndOfBufferCharacter))
s.WriteString(eob) s.WriteString(eob)
} }
} }
+29 -29
View File
@@ -429,11 +429,11 @@ func TestView(t *testing.T) {
name: "placeholder", name: "placeholder",
expected: heredoc.Doc(` expected: heredoc.Doc(`
> 1 Hello, World! > 1 Hello, World!
> ~ > ~
> ~ > ~
> ~ > ~
> ~ > ~
> ~ > ~
`), `),
}, },
{ {
@@ -445,11 +445,11 @@ func TestView(t *testing.T) {
}, },
expected: heredoc.Doc(` expected: heredoc.Doc(`
> 1 the first line > 1 the first line
> ~ > ~
> ~ > ~
> ~ > ~
> ~ > ~
> ~ > ~
`), `),
}, },
{ {
@@ -463,9 +463,9 @@ func TestView(t *testing.T) {
> 1 the first line > 1 the first line
> 2 the second line > 2 the second line
> 3 the third line > 3 the third line
> ~ > ~
> ~ > ~
> ~ > ~
`), `),
}, },
{ {
@@ -512,11 +512,11 @@ func TestView(t *testing.T) {
}, },
expected: heredoc.Doc(` expected: heredoc.Doc(`
> 1 the first line > 1 the first line
> * > *
> * > *
> * > *
> * > *
> * > *
`), `),
}, },
{ {
@@ -531,9 +531,9 @@ func TestView(t *testing.T) {
> 1 the first line > 1 the first line
> 2 the second line > 2 the second line
> 3 the third line > 3 the third line
> * > *
> * > *
> * > *
`), `),
}, },
{ {
@@ -582,11 +582,11 @@ func TestView(t *testing.T) {
}, },
expected: heredoc.Doc(` expected: heredoc.Doc(`
* 1 the first line * 1 the first line
* ~ * ~
* ~ * ~
* ~ * ~
* ~ * ~
* ~ * ~
`), `),
}, },
{ {
@@ -601,9 +601,9 @@ func TestView(t *testing.T) {
* 1 the first line * 1 the first line
* 2 the second line * 2 the second line
* 3 the third line * 3 the third line
* ~ * ~
* ~ * ~
* ~ * ~
`), `),
}, },
} }