TestCarriageReturnLineEndings: lone-\r separators (old-mac-style, some VS Code TERM setups) must still yield a correct chip line count. bubbles/textarea splits only on \n, so we count separators ourselves.
(t *testing.T)
| 404 | // TERM setups) must still yield a correct chip line count. bubbles/textarea |
| 405 | // splits only on \n, so we count separators ourselves. |
| 406 | func TestCarriageReturnLineEndings(t *testing.T) { |
| 407 | p := newChippablePrompt() |
| 408 | // 10-line paste, \r separators only. |
| 409 | paste := strings.Repeat("line\r", 9) + "end" |
| 410 | p, _ = p.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune(paste), Paste: true}) |
| 411 | |
| 412 | if len(p.spans) != 1 { |
| 413 | t.Fatalf("\\r-separated paste should still chip; spans=%+v", p.spans) |
| 414 | } |
| 415 | wantLabel := "[Pasted text +10 lines]" |
| 416 | if got := p.DisplayValue(); got != wantLabel { |
| 417 | t.Fatalf("label should report the real line count; got %q want %q", |
| 418 | got, wantLabel) |
| 419 | } |
| 420 | } |
| 421 | |
| 422 | // TestCRLFLineEndings: Windows \r\n counts each line once, not twice. |
| 423 | func TestCRLFLineEndings(t *testing.T) { |
nothing calls this directly
no test coverage detected