Commit 1a1828f
committed
fix(prompts): properly calculate multiselect row padding on narrow terminals
This corrects a terminal rendering bug in the MultiSelectPrompt (Issue #116).
Previously, terminal row padding calculations contained two offsetting errors:
1. \ itleLineCount\ was overestimating by 1 due to trailing newlines.
2. \ooterLineCount\ was underestimating on narrow terminals because the footer string wasn't properly wrapped.
When the terminal filled up, this offset math caused the \limitOptions\ slicing window to miscalculate available space by 1 row, causing the prompt to overflow the terminal and visually overwrite itself on redraw.
This fix correctly evaluates both bounds using \wrapTextWithPrefix\ and ensures small terminals gracefully constrain multiselect options.
Signed-off-by: Harshal Patel <hp842484@gmail.com>1 parent 8f1c380 commit 1a1828f
4 files changed
Lines changed: 990 additions & 896 deletions
File tree
- .changeset
- packages/prompts
- src
- test
- __snapshots__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
170 | 170 | | |
171 | 171 | | |
172 | 172 | | |
173 | | - | |
174 | | - | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
175 | 176 | | |
176 | 177 | | |
177 | 178 | | |
| |||
184 | 185 | | |
185 | 186 | | |
186 | 187 | | |
187 | | - | |
| 188 | + | |
188 | 189 | | |
189 | 190 | | |
190 | 191 | | |
191 | 192 | | |
192 | 193 | | |
193 | 194 | | |
194 | | - | |
| 195 | + | |
| 196 | + | |
195 | 197 | | |
196 | 198 | | |
197 | 199 | | |
| |||
0 commit comments