Commit 6929767
committed
fix(tui): prevent underflow in dropdown navigation and scroll calculations
Fixes #5182, #5180, #5176
- Add guard for max_visible=0 in dropdown select_next/select_prev
- Use saturating_sub in scroll.ensure_visible to prevent underflow
- Add bounds checking in scrollable_dropdown visible_items
- Guard against max_visible=0 in select_next/select_prev/calculate_scroll_offset1 parent 66f1b2c commit 6929767
File tree
3 files changed
+18
-11
lines changed- src
- cortex-tui-components/src
- cortex-tui/src/widgets
3 files changed
+18
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
102 | | - | |
| 102 | + | |
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
111 | | - | |
| 111 | + | |
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
122 | 126 | | |
123 | 127 | | |
124 | 128 | | |
125 | 129 | | |
126 | 130 | | |
127 | | - | |
| 131 | + | |
128 | 132 | | |
129 | 133 | | |
130 | 134 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
254 | 254 | | |
255 | 255 | | |
256 | 256 | | |
257 | | - | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
258 | 261 | | |
259 | | - | |
| 262 | + | |
260 | 263 | | |
261 | 264 | | |
262 | 265 | | |
| |||
459 | 462 | | |
460 | 463 | | |
461 | 464 | | |
462 | | - | |
| 465 | + | |
463 | 466 | | |
464 | 467 | | |
465 | 468 | | |
| |||
468 | 471 | | |
469 | 472 | | |
470 | 473 | | |
471 | | - | |
| 474 | + | |
472 | 475 | | |
473 | 476 | | |
474 | 477 | | |
| |||
482 | 485 | | |
483 | 486 | | |
484 | 487 | | |
485 | | - | |
| 488 | + | |
486 | 489 | | |
487 | 490 | | |
488 | 491 | | |
| |||
511 | 514 | | |
512 | 515 | | |
513 | 516 | | |
514 | | - | |
| 517 | + | |
515 | 518 | | |
516 | 519 | | |
517 | 520 | | |
| |||
521 | 524 | | |
522 | 525 | | |
523 | 526 | | |
524 | | - | |
525 | | - | |
| 527 | + | |
| 528 | + | |
526 | 529 | | |
527 | 530 | | |
528 | 531 | | |
| |||
0 commit comments