TestBackspaceNotAtChipBoundaryFallsThrough: Backspace away from a chip boundary deletes one char normally, chip untouched.
(t *testing.T)
| 351 | // TestBackspaceNotAtChipBoundaryFallsThrough: Backspace away from a chip boundary |
| 352 | // deletes one char normally, chip untouched. |
| 353 | func TestBackspaceNotAtChipBoundaryFallsThrough(t *testing.T) { |
| 354 | p := newChippablePrompt() |
| 355 | p, _ = p.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune("hello")}) |
| 356 | p, _ = p.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune(" ")}) |
| 357 | p, _ = p.Update(pasteKey(makePaste(9))) |
| 358 | // Cursor ends past the chip; backspace must remove "X", not the chip. |
| 359 | p, _ = p.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune("X")}) |
| 360 | |
| 361 | p, _ = p.Update(tea.KeyMsg{Type: tea.KeyBackspace}) |
| 362 | if len(p.spans) != 1 { |
| 363 | t.Fatal("Backspace after non-chip character must not remove the chip") |
| 364 | } |
| 365 | if strings.HasSuffix(p.DisplayValue(), "X") { |
| 366 | t.Fatal("Backspace should have removed the trailing 'X'") |
| 367 | } |
| 368 | } |
| 369 | |
| 370 | // TestPageKeysMoveCursorByHeight: PgUp/PgDn move the cursor by one prompt-height. |
| 371 | // bubbles/textarea ships an empty viewport keymap, so without our handling |
nothing calls this directly
no test coverage detected