Commit 775616a
authored
fix: resolve
## Background
The global `vp` CLI appeared to hang in Warp terminal, requiring a
keypress before any output was displayed. This affected both the bare
`vp` command (interactive picker) and subcommands like `vp create` that
delegate to Node.js. The issue did not occur in other terminals such as
iTerm2 or Terminal.app.
## Root Cause
`vite_shared::header::vite_plus_header()` calls `query_terminal_colors()`
which sends OSC escape sequences (`\x1b]10;?\x1b\\` for foreground color
and `\x1b]4;N;?\x1b\\` for palette colors) to `/dev/tty` in raw mode to
read the terminal's color values for the header gradient. Most terminals
respond to these queries, but Warp's block-mode renderer does not. The
function then blocks on `poll()`/`read()` waiting for a response that
never comes, consuming the next keypress as a fake "response" instead.
Since the header is rendered on nearly every command, this caused the
CLI to appear stuck on every invocation in Warp.
## Fix
1. **Skip OSC color queries in Warp** (`header.rs`): Early-return from
`query_terminal_colors()` when `TERM_PROGRAM=WarpTerminal`, falling
back to default blue/magenta colors. This matches the existing CI
environment skip pattern.
2. **Use alternate screen for the picker** (`command_picker.rs`): Switch
the interactive command picker to use `EnterAlternateScreen` /
`LeaveAlternateScreen` instead of `Clear(ClearType::All)` + manual
cursor reset. This is standard TUI practice and avoids a large blank
area that Warp's block-mode renderer created with the previous
clear-based approach.
3. **Conditional padding for Warp** (`command_picker.rs`): Warp renders
alternate screen content flush against the edges. Add a 1-line top
margin and 1-space left margin only when running in Warp to improve
readability, without affecting other terminals.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Touches terminal I/O and TUI screen-management paths, which can regress rendering or leave terminals in a bad state if edge cases are missed, but changes are scoped to UI behavior and add explicit cleanup/error handling.
>
> **Overview**
> Fixes `vp` appearing to hang in Warp by detecting Warp (`TERM_PROGRAM=WarpTerminal`) and **skipping OSC color queries** in `vite_shared::header::query_terminal_colors`, falling back to default header colors.
>
> Updates the interactive command picker to use the terminal **alternate screen** (`EnterAlternateScreen`/`LeaveAlternateScreen`) with safer event/error handling, and adds Warp-specific padding plus a viewport-size adjustment (`compute_viewport_size` now accounts for header overhead; tests updated accordingly).
>
> <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 5bebc95. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->vp hanging on launch in Warp terminal (#762)1 parent e48cb0c commit 775616a
2 files changed
Lines changed: 82 additions & 47 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
163 | 166 | | |
164 | | - | |
| 167 | + | |
165 | 168 | | |
166 | 169 | | |
167 | 170 | | |
| |||
177 | 180 | | |
178 | 181 | | |
179 | 182 | | |
180 | | - | |
| 183 | + | |
| 184 | + | |
181 | 185 | | |
182 | | - | |
| 186 | + | |
183 | 187 | | |
184 | 188 | | |
185 | 189 | | |
186 | 190 | | |
187 | 191 | | |
188 | 192 | | |
189 | | - | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
190 | 197 | | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
208 | 218 | | |
209 | | - | |
210 | 219 | | |
| 220 | + | |
| 221 | + | |
211 | 222 | | |
212 | 223 | | |
213 | 224 | | |
| |||
221 | 232 | | |
222 | 233 | | |
223 | 234 | | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
| 235 | + | |
231 | 236 | | |
232 | 237 | | |
233 | 238 | | |
| |||
294 | 299 | | |
295 | 300 | | |
296 | 301 | | |
297 | | - | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
298 | 306 | | |
299 | 307 | | |
300 | 308 | | |
301 | 309 | | |
302 | 310 | | |
303 | 311 | | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
304 | 316 | | |
305 | 317 | | |
306 | | - | |
307 | | - | |
308 | | - | |
| 318 | + | |
309 | 319 | | |
310 | 320 | | |
311 | | - | |
| 321 | + | |
312 | 322 | | |
313 | 323 | | |
314 | 324 | | |
| |||
317 | 327 | | |
318 | 328 | | |
319 | 329 | | |
320 | | - | |
| 330 | + | |
321 | 331 | | |
322 | 332 | | |
323 | 333 | | |
| |||
337 | 347 | | |
338 | 348 | | |
339 | 349 | | |
340 | | - | |
| 350 | + | |
341 | 351 | | |
342 | 352 | | |
343 | 353 | | |
| |||
371 | 381 | | |
372 | 382 | | |
373 | 383 | | |
374 | | - | |
| 384 | + | |
375 | 385 | | |
376 | 386 | | |
377 | 387 | | |
| |||
391 | 401 | | |
392 | 402 | | |
393 | 403 | | |
394 | | - | |
| 404 | + | |
395 | 405 | | |
396 | 406 | | |
397 | 407 | | |
| |||
403 | 413 | | |
404 | 414 | | |
405 | 415 | | |
406 | | - | |
| 416 | + | |
407 | 417 | | |
408 | 418 | | |
409 | 419 | | |
| |||
420 | 430 | | |
421 | 431 | | |
422 | 432 | | |
423 | | - | |
| 433 | + | |
424 | 434 | | |
425 | 435 | | |
426 | 436 | | |
| |||
430 | 440 | | |
431 | 441 | | |
432 | 442 | | |
433 | | - | |
434 | | - | |
435 | | - | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
436 | 449 | | |
437 | 450 | | |
438 | 451 | | |
| |||
572 | 585 | | |
573 | 586 | | |
574 | 587 | | |
575 | | - | |
576 | | - | |
577 | | - | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
578 | 594 | | |
579 | 595 | | |
580 | 596 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
10 | 13 | | |
11 | 14 | | |
12 | 15 | | |
| |||
31 | 34 | | |
32 | 35 | | |
33 | 36 | | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
34 | 46 | | |
35 | 47 | | |
36 | 48 | | |
| |||
184 | 196 | | |
185 | 197 | | |
186 | 198 | | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
187 | 206 | | |
188 | 207 | | |
189 | 208 | | |
| |||
0 commit comments