feat: port dual-line status bar support feature from tmux-powerline stale#75
feat: port dual-line status bar support feature from tmux-powerline stale#75nuffin wants to merge 3 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughA new ChangesDual Status Bar Feature
Sequence Diagram(s)sequenceDiagram
participant tmux.conf as tmux.conf (user config)
participant main
participant configure_dual_status_bars
participant build_status_format_0
participant build_status_format_1
tmux.conf->>main: status_lines=2 (or unset → "1")
alt status_lines == "1"
main->>main: build_left_status / build_right_status
else status_lines != "1"
main->>configure_dual_status_bars: invoke
configure_dual_status_bars->>configure_dual_status_bars: tmux set status 2
configure_dual_status_bars->>build_status_format_0: build status-format[0]
build_status_format_0-->>configure_dual_status_bars: left/center/right format string
configure_dual_status_bars->>build_status_format_1: build status-format[1]
build_status_format_1-->>configure_dual_status_bars: left/center/right format string
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
tmux-power.tmux (1)
352-357: 💤 Low valueConsider explicit validation for
status_lines.The current logic treats any value other than
"1"as dual-mode. A user typo likestatus_lines='yes'or an empty value would silently enable dual status bars. For robustness, you could validate the input:💡 Optional: explicit value check
- if [[ "$status_lines" == "1" ]]; then + if [[ "$status_lines" == "1" ]]; then build_left_status build_right_status + elif [[ "$status_lines" == "2" ]]; then + configure_dual_status_bars else - configure_dual_status_bars + # Fallback to single status bar for invalid values + build_left_status + build_right_status fiThis is optional—the current approach is a common shell pattern and works correctly for intended use.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tmux-power.tmux` around lines 352 - 357, The conditional logic in the status_lines check currently treats any value other than "1" as dual-mode, which means typos or unexpected values would silently enable dual status bars without validation. Add explicit validation for the status_lines variable to ensure it only accepts known valid values (such as "1" for single mode and perhaps "2" for dual mode), and handle invalid values appropriately—either by logging an error, using a default, or failing gracefully. Update the if condition to check for the specific valid values rather than relying on an else clause that implicitly accepts everything else.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@tmux-power.tmux`:
- Around line 352-357: The conditional logic in the status_lines check currently
treats any value other than "1" as dual-mode, which means typos or unexpected
values would silently enable dual status bars without validation. Add explicit
validation for the status_lines variable to ensure it only accepts known valid
values (such as "1" for single mode and perhaps "2" for dual mode), and handle
invalid values appropriately—either by logging an error, using a default, or
failing gracefully. Update the if condition to check for the specific valid
values rather than relying on an else clause that implicitly accepts everything
else.
3ccaa70 to
cc2f1e4
Compare
Description
Updated with upstream, and use functions to config the dual status bars.
I always open two many windows with long titles to, so only one line is not enough.
After a year, I refactor the code to make it more readable and editable. Tested on 2 boxes, work fine.
Checklist
gold,everforest, etc.)Summary by CodeRabbit
status_linessetting to switch between single (1) and dual (2) status bar configurations