handlePageKey implements PgUp/PgDn. textarea disables its viewport keymap, so page keys aren't wired, so we translate them to N×CursorUp/CursorDown (one visible page, letting the viewport scroll to match), then snap out of any chip the move landed inside so the cursor never renders mid-label.
(msg tea.KeyMsg)
| 125 | // visible page, letting the viewport scroll to match), then snap out of any |
| 126 | // chip the move landed inside so the cursor never renders mid-label. |
| 127 | func (p promptInput) handlePageKey(msg tea.KeyMsg) (bool, promptInput) { |
| 128 | var step func() |
| 129 | switch msg.Type { |
| 130 | case tea.KeyPgUp: |
| 131 | step = func() { p.ta.CursorUp() } |
| 132 | case tea.KeyPgDown: |
| 133 | step = func() { p.ta.CursorDown() } |
| 134 | default: |
| 135 | return false, p |
| 136 | } |
| 137 | n := max(p.ta.Height(), 1) |
| 138 | for range n { |
| 139 | step() |
| 140 | } |
| 141 | p.snapCursorOutOfChip() |
| 142 | return true, p |
| 143 | } |
| 144 | |
| 145 | // snapCursorOutOfChip snaps a cursor sitting strictly inside a chip to the |
| 146 | // nearer boundary. Returns the (possibly adjusted) offset so callers skip a |
no test coverage detected