handleResizeSettle fires once the post-resize debounce expires for the matching gen. Wipes the terminal (so previous-width rows can't soft-wrap into stair-steps), then re-emits splash, replayed scroll, and any pending outbox at the new width. Older debounces self-discard on the gen check.
(msg resizeSettleMsg)
| 546 | return resizeSettleMsg{gen: gen} |
| 547 | }) |
| 548 | } |
| 549 | |
| 550 | // handleResizeSettle fires once the post-resize debounce expires for the |
| 551 | // matching gen. Wipes the terminal (so previous-width rows can't soft-wrap into |
| 552 | // stair-steps), then re-emits splash, replayed scroll, and any pending outbox |
| 553 | // at the new width. Older debounces self-discard on the gen check. |
| 554 | func (m Model) handleResizeSettle(msg resizeSettleMsg) (tea.Model, tea.Cmd) { |
| 555 | if msg.gen != m.resizeGen { |
| 556 | return m, nil |
| 557 | } |
| 558 | m.suppressView = false |
| 559 | // tea.Sequence keeps order strict; Batch would race the clears with the |
| 560 | // writes. After the wipe every line below is emitted at the current width, |
| 561 | // so no previous-width row can soft-wrap into stair-steps. |
| 562 | cmds := []tea.Cmd{tea.ClearScreen, eraseScrollback} |
| 563 | if splash := strings.Join(m.splashLines(), "\n"); splash != "" { |
| 564 | cmds = append(cmds, tea.Println(wrapForScrollback(splash, m.width))) |
| 565 | } |
| 566 | if scroll := strings.TrimRight(m.scroll.String(), "\n"); scroll != "" { |
| 567 | cmds = append(cmds, tea.Println(wrapForScrollback(scroll, m.width))) |
| 568 | } |
| 569 | if len(m.outbox) > 0 { |
| 570 | cmds = append(cmds, tea.Println(wrapForScrollback(strings.Join(m.outbox, "\n"), m.width))) |
| 571 | m.outbox = nil |
no test coverage detected