Commit 68cae8a
committed
Address review: fix clipAnsi reset, section/path width floors, normalizeScrollOffset fixed-point
Four follow-up fixes from code review on PR #106:
1. clipAnsi: replace \x1b[0m (full SGR reset) with \x1b[22;39m (reset
bold + fg only). A full reset clears any background set by the caller,
so renderActiveLine's dark-purple bg was wiped mid-line on narrow
terminals when the repo name or file path was clipped.
2. Section label width: change Math.max(4, termWidth - SECTION_FIXED) to
Math.max(0, …). The old floor of 4 could exceed the actual available
width on very narrow terminals, forcing the section header line wider
than termWidth and re-introducing wrapping. When maxLabelChars === 0
the section is counted toward usedLines but not pushed to output.
3. Extract path width: change Math.max(10, …) to Math.max(1, …). Same
reasoning as above — the floor of 10 could exceed the available width
on very narrow terminals.
4. normalizeScrollOffset fixed-point loop: replace single-pass call with
a loop that iterates until (scrollOffset, viewportHeight) stabilises.
getViewportHeight depends on scrollOffset (sticky-header condition),
so decreasing scrollOffset can toggle the sticky header, changing
viewportHeight by 1 and causing a single pass to stop 1 row early.1 parent b5c4382 commit 68cae8a
2 files changed
Lines changed: 32 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
226 | 226 | | |
227 | 227 | | |
228 | 228 | | |
229 | | - | |
230 | | - | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
231 | 235 | | |
232 | 236 | | |
233 | 237 | | |
| |||
499 | 503 | | |
500 | 504 | | |
501 | 505 | | |
502 | | - | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
503 | 516 | | |
504 | 517 | | |
505 | 518 | | |
| |||
571 | 584 | | |
572 | 585 | | |
573 | 586 | | |
574 | | - | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
575 | 592 | | |
576 | 593 | | |
577 | 594 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
197 | 197 | | |
198 | 198 | | |
199 | 199 | | |
200 | | - | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
201 | 211 | | |
202 | 212 | | |
203 | 213 | | |
| |||
0 commit comments