mirror of
https://github.com/zoriya/bubbles.git
synced 2026-08-16 01:43:21 +00:00
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:
committed by
Maas Lalani
parent
a6a12c4a31
commit
db06ae17d3
@@ -325,7 +325,7 @@ func (m *Model) insertRunesFromUserInput(runes []rune) {
|
|||||||
lstart = i + 1
|
lstart = i + 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if lstart < len(runes) {
|
if lstart <= len(runes) {
|
||||||
// The last line did not end with a newline character.
|
// The last line did not end with a newline character.
|
||||||
// Take it now.
|
// Take it now.
|
||||||
lines = append(lines, runes[lstart:])
|
lines = append(lines, runes[lstart:])
|
||||||
|
|||||||
Reference in New Issue
Block a user