fix(textarea): support pastes that end with a newline character

My previous fix did not properly handle a multi-rune input that *ends*
with a newline character. In that case, the final newline was removed.

I found this using the test suite I built for textarea in bubbline at
https://github.com/knz/bubbline/tree/main/editline/internal/textarea/testdata.
This commit is contained in:
Raphael 'kena' Poss
2023-01-24 14:19:14 -05:00
committed by Maas Lalani
parent a6a12c4a31
commit db06ae17d3
+1 -1
View File
@@ -325,7 +325,7 @@ func (m *Model) insertRunesFromUserInput(runes []rune) {
lstart = i + 1
}
}
if lstart < len(runes) {
if lstart <= len(runes) {
// The last line did not end with a newline character.
// Take it now.
lines = append(lines, runes[lstart:])