Repository navigation
Restore support for the bar view on the date and time meters. - #2130
lvaschmidt wants to merge 2 commits into
Conversation
📝 WalkthroughWalkthroughThe clock, date, and date-time meters now support bar mode and expose progress values. Date and date-time totals account for Gregorian leap years. The date-time meter uses Priority: ⬇️ Low Change: Bug fix Merge Risk: 🔵 Low · up to The Date & Time bar may show “Dat” instead of the stated “D&T,” a small but visible labeling mismatch. Confirm the intended caption or restore the short label before merging.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. The clock marks minutes through the day Comment |
|
@BenBE and me would generally be in favor of merging this. But: This is AI messy, so please:
|
|
When you want no _getCaption, does that mean you want the bar for Date and Time to be labeled "Dat", you don't want it changed to "D&T"? From my understanding, the _getCaption was the way that other meters with variable labels did it. But I can remove that aspect entirely. Sure. Will do the rest. |
Restore day and year progress bars while preserving the original captions. Share the year-progress calculation for Date and DateTime and select their text format with a ternary expression. Assisted-by: ChatGPT Signed-off-by: Lysander Schmidt <me@LysanderSchmidt.com>
Assisted-by: ChatGPT Signed-off-by: Lysander Schmidt <me@LysanderSchmidt.com>
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: ASSERTIVE
- Plan: Advanced
- Run ID:
ff050669-4428-4600-b079-0b37a3034ed6
📒 Files selected for processing (1)
DateTimeMeter.c
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
| .supportedModes = (1 << TEXT_METERMODE) | (1 << LED_METERMODE), | ||
| .maxItems = 0, | ||
| .total = 0.0, | ||
| .supportedModes = (1 << BAR_METERMODE) | (1 << TEXT_METERMODE) | (1 << LED_METERMODE), |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Inspect caption lookup and any DateTime-specific getter.
rg -n -C 8 '\bMeter_getCaption\b|\.getCaption|DateTimeMeter_class' Meter.c Meter.h DateTimeMeter.cRepository: htop-dev/htop
Length of output: 4759
🏁 Script executed:
set -euo pipefail
printf '%s\n' '--- DateTimeMeter.c at reviewed head ---'
nl -ba DateTimeMeter.c | sed -n '1,115p'
printf '%s\n' '--- relevant diff from merge base ---'
git diff --no-ext-diff --unified=20 44a59cf1b407df3a1853e9f4f86c3f366808c9e0 fe8c9177bcb451d627339b1a1adf45cf47c11b51 -- DateTimeMeter.c Meter.c Meter.hRepository: htop-dev/htop
Length of output: 6359
Confirm the intended Date & Time bar caption.
BarMeterMode_draw displays the first three characters from Meter_getCaption(). Because DateTimeMeter_class has no custom getter, its "Date & Time: " caption renders as Dat, not D&T. If D&T remains required, add a Date & Time-specific caption getter that preserves the existing text and LED captions.

This overturns a little bit of #1387 , restoring the bar type for Time, Date, and Date & Time meters. This addresses this comment by execvpe, which @BenBE seemed open to?
This change restores those meters to the way they were, reusing the code from before the change, so I wasn't writing new code.
^Here's how they look in my testing of this PR.
One tiny additional change is to fix the oversight in the Black Night theme that failed to label the Date and DateTime meters green the way all similar meters are labeled in that theme.
^The date meters in the corrected color.
I also changed the caption of the date meter in the bar mode to "D&T", which seemed appropriate as far as I could tell.
ChatGPT helped make the PR, and I tested it by hand.