chipAtBoundary returns the chip whose start (atStart=true) or end (atStart=false) coincides with cur, the check Backspace/Delete/Left/Right share.
(cur int, atStart bool)
| 163 | // chipAtBoundary returns the chip whose start (atStart=true) or end |
| 164 | // (atStart=false) coincides with cur, the check Backspace/Delete/Left/Right share. |
| 165 | func (p promptInput) chipAtBoundary(cur int, atStart bool) (chipSpan, bool) { |
| 166 | for _, chip := range p.spans { |
| 167 | boundary := chip.end |
| 168 | if atStart { |
| 169 | boundary = chip.start |
| 170 | } |
| 171 | if cur == boundary { |
| 172 | return chip, true |
| 173 | } |
| 174 | } |
| 175 | return chipSpan{}, false |
| 176 | } |
| 177 | |
| 178 | // looksLikePaste recognises paste-like key events. Primary signal: the |
| 179 | // bracketed-paste Paste flag (terminal wraps content in \x1b[200~...\x1b[201~). |