fix(ui): config の status_bar_position(top/bottom)をレイアウトに反映#4
Conversation
Config documented a top/bottom status bar, but the server always drew it on the last row and laid out pane content as if the bar were at the bottom. Add clientLayout() to compute tab bar, content region, and status row from config; use it in composeForClient, resizePtysForClient, and focus_pane. Respect status_bar when sizing new PTY grids. Add layout unit tests. Co-authored-by: midasdf <midasdf@users.noreply.github.com>
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 49 minutes and 48 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthrough複数のモジュールにおいて、Unicode文字の表示幅を計算する新しい Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25分 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 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 |
|
|
Overall Grade |
Security Reliability Complexity Hygiene |
Code Review Summary
| Analyzer | Status | Updated (UTC) | Details |
|---|---|---|---|
| Secrets | Apr 13, 2026 4:29p.m. | Review ↗ |
Important
AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.
Up to standards ✅🟢 Issues
|
There was a problem hiding this comment.
Pull Request Overview
The PR introduces a unified clientLayout function to handle status_bar_position ('top' or 'bottom'), which is a necessary improvement for UI consistency. However, the review process has identified that the unit tests required to validate these layout variations and PTY resizing logic are missing from the implementation.
While Codacy marks the PR as 'up to standards' regarding code quality, it explicitly flags a failure in meeting coverage requirements. Given the complexity of coordinate calculations and their impact on PTY sizing, the absence of these tests should prevent merging until the verification suite is included.
About this PR
- Critical unit tests for layout variations (top, bottom, and disabled status bar) and PTY row count calculations are missing. These are essential to ensure the new
clientLayoutlogic correctly handles all configuration states. - Codacy reports that coverage requirements are not met. Please ensure that the new layout logic is covered by automated unit tests to prevent future regressions in UI positioning.
Test suggestions
- Verify layout coordinate calculations for 'top' status bar position
- Verify layout coordinate calculations for 'bottom' status bar position
- Verify layout coordinate calculations when the status bar is disabled
- Verify PTY row count calculation when status bar is disabled
Prompt proposal for missing tests
Consider implementing these tests if applicable:
1. Verify layout coordinate calculations for 'top' status bar position
2. Verify layout coordinate calculations for 'bottom' status bar position
3. Verify layout coordinate calculations when the status bar is disabled
4. Verify PTY row count calculation when status bar is disabled
🗒️ Improve review quality by adding custom instructions
There was a problem hiding this comment.
Code Review
This pull request introduces a clientLayout helper function in src/server.zig to centralize UI layout calculations, replacing manual logic across the server implementation and adding corresponding unit tests. The review feedback identifies a missed opportunity to use this new helper in the PTY spawning logic, which would further improve code consistency and reduce duplication.
| const tab_r: u16 = if (c_rows > 0) 1 else 0; | ||
| const status_r: u16 = if (self.config.status_bar and c_rows > 0) 1 else 0; | ||
| const reserved_rows: u16 = tab_r + status_r + 2; // UI chrome + pane border top/bottom |
There was a problem hiding this comment.
- Add unicode_width.eastAsianDisplayWidth shared with grid title rendering - drawBorderWithTitle decodes UTF-8 and places wide-char spacer cells - status_bar writeString advances two cells for width-2 codepoints - sendDirtyRegionsTo tracks column by display width after emitting glyphs Tests cover titled border with 漢 and status bar writeString wide output. Co-authored-by: midasdf <midasdf@users.noreply.github.com>
|
CodeAnt AI is reviewing your PR. |
|
CodeAnt AI finished reviewing your PR. |
… pad - Expand unicode_width with zero-width combining ranges, emoji/pictograph width-2 blocks, and terminalDisplayWidth() API - Grid .print: width 0 codepoints skip (no spurious column advance) - Status bar / titles / server render already use terminalDisplayWidth - serializeCell: skip width-0; append space after width-2 glyphs for raw TTY Tests: combining, ZWJ, VS16, emoji, serializeCell trailing space. Co-authored-by: midasdf <midasdf@users.noreply.github.com>
User description
問題
status_bar_positionが無視されていた — 常に最下行にステータスを描画し、ペイン領域もその前提で計算していた。対応
clientLayout()で top/bottom のステータス行とコンテンツ領域を統一(compose / resize / focus_pane / 新規 PTY 初期行数)。unicode_width.zig:terminalDisplayWidth()— 広い結合文字・書記素用ゼロ幅レンジ、東アジア幅、絵文字/記号の幅 2 ブロック(libc wcwidth と完全一致ではないが TUI 向け)。grid.print: 幅 0 のコードポイントは列を進めずスキップ(オーバーレイは 1 セルモデルでは表現不可)。sendDirtyRegionsTo:terminalDisplayWidthを使用。serializeCell: 幅 0 は出力なし、幅 2 は UTF-8 の後にスペースを付与(素の TTY でも 2 列進むように)。テスト
zig build test(Zig 0.15.2)注意
CodeAnt-AI Description
Honor status bar placement and render wide characters correctly
What Changed
Impact
✅ Correct top or bottom status bar placement✅ Fewer pane layout shifts✅ Clearer CJK titles and status text💡 Usage Guide
Checking Your Pull Request
Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.
Talking to CodeAnt AI
Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:
This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.
Example
Preserve Org Learnings with CodeAnt
You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:
This helps CodeAnt AI learn and adapt to your team's coding style and standards.
Example
Retrigger review
Ask CodeAnt AI to review the PR again, by typing:
Check Your Repository Health
To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.
Summary by CodeRabbit
リリースノート
新機能
テスト