Skip to content
This repository was archived by the owner on Jul 30, 2026. It is now read-only.

fix(tui): align header tab click areas - #10

Merged
makoMakoGo merged 3 commits into
personal/local-clientsfrom
fix/tui-header-tab-click-areas
May 17, 2026
Merged

fix(tui): align header tab click areas#10
makoMakoGo merged 3 commits into
personal/local-clientsfrom
fix/tui-header-tab-click-areas

Conversation

@makoMakoGo

@makoMakoGo makoMakoGo commented May 16, 2026

Copy link
Copy Markdown
Owner

Summary

  • Fix TUI header tab mouse hitboxes to match the rendered tab labels instead of using a hardcoded horizontal offset
  • Share header block/divider/padding assumptions between rendering and hitbox registration
  • Add regression tests for normal and very-narrow tab labels with nonzero header offsets

Fixes #9.

Tests

  • cargo fmt --manifest-path /home/travis/01-workspace/tokscale/crates/tokscale-cli/Cargo.toml -- --check
  • cargo test --manifest-path /home/travis/01-workspace/tokscale/crates/tokscale-cli/Cargo.toml tui::ui::header::tests -- --nocapture
  • cargo clippy --manifest-path /home/travis/01-workspace/tokscale/crates/tokscale-cli/Cargo.toml --all-targets
  • cargo test --manifest-path /home/travis/01-workspace/tokscale/crates/tokscale-cli/Cargo.toml

Summary by CodeRabbit

版本说明

  • Bug 修复

    • 改进了标题区域的标签页点击检测,确保点击精准定位到正确的标签页。
    • 修复了不同屏幕宽度下标签页显示的对齐和间距问题。
  • 改进

    • 优化了超窄屏幕显示下的标签页渲染效果。
    • 增强了标题区域在不同视图模式下的显示逻辑。

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 16, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 14fcecca-ce38-40ce-8bb4-e1c62a00f950

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/tui-header-tab-click-areas

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the TUI header rendering to use the ratatui Tabs widget and implements mouse click registration for tab navigation, supported by new unit tests. Feedback focuses on optimizing performance by avoiding redundant calculations of the header block and improving user experience by expanding tab click hitboxes to include padding.

Comment thread crates/tokscale-cli/src/tui/ui/header.rs Outdated
Comment thread crates/tokscale-cli/src/tui/ui/header.rs Outdated
Comment thread crates/tokscale-cli/src/tui/ui/header.rs

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 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.

Inline comments:
In `@crates/tokscale-cli/src/tui/ui/header.rs`:
- Around line 87-138: The register_tab_click_areas function currently ignores
the tabs_area height and may register click areas with height 1 even when
tabs_area.height == 0; fix by checking tabs_area.height (or tabs_area.height ==
0) at the start of register_tab_click_areas and return early if it's zero so no
Rect::new(..., 1) click areas are created (affecting app.add_click_area and
ClickAction::Tab registrations for Tab::all()).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 036da964-19d1-4b10-bd92-7bf452d10aad

📥 Commits

Reviewing files that changed from the base of the PR and between 730c88f and baeddee.

📒 Files selected for processing (1)
  • crates/tokscale-cli/src/tui/ui/header.rs

Comment thread crates/tokscale-cli/src/tui/ui/header.rs Outdated
@makoMakoGo
makoMakoGo merged commit 3d40d01 into personal/local-clients May 17, 2026
3 checks passed
@makoMakoGo
makoMakoGo deleted the fix/tui-header-tab-click-areas branch May 17, 2026 04:13
makoMakoGo pushed a commit that referenced this pull request Jun 18, 2026
junhoyeo#713)

* feat(sessions): read Antigravity CLI usage from local SQLite databases

The Antigravity CLI (the terminal agent that stores its data under `~/.gemini/antigravity-cli/`) was never counted. tokscale only knew two Gemini-family sources: the Gemini CLI (scans `~/.gemini/tmp/*.{json,jsonl}`) and Antigravity (pulls usage from a running IDE language server over RPC and caches it under the config dir). The Antigravity CLI fell into neither bucket, so its on-disk usage was invisible — `tokscale antigravity sync` found the filesystem candidates but cached zero because its only artifact path still requires a live language-server RPC connection.

This adds Antigravity CLI as a first-class local scan source so its usage updates automatically like every other file-based source — no RPC, no `antigravity sync`. A new `antigravity-cli` client globs `~/.gemini/antigravity-cli/conversations/*.db` (honoring `GEMINI_CLI_HOME`) and a new parser reads each conversation database directly.

Each `gen_metadata` row is one generation encoded as the same `GeneratorMetadata` protobuf the IDE returns over `GetCascadeTrajectoryGeneratorMetadata`. The repository has no `.proto`/prost decoder (the IDE path receives JSON because the language server does the proto-to-JSON conversion), so the parser ships a tiny dependency-free wire-format reader and pulls only the fields it needs. The field numbers were reverse-engineered from real databases and cross-checked across 6 sessions / 140 turns: `chatModel.#19` is the response model, `usage.#5`/`#9`/`#10` are cacheRead/output/thinking (verified by the invariant `#9 + #10 == #3`, the stored total output), `#11` is the responseId used for dedup, and input combines the fixed system-prompt count `#1` with the newly-processed input `#2`. The session timestamp and workspace come from `trajectory_metadata_blob`.

Adding the new `ClientId` variant fans out to the usual registration points: the scanner gains a `*.db` glob arm (which naturally rejects `.db-wal`/`.db-shm` sidecars), both local-parse dispatch paths gain a branch, and the CLI `ClientFilter`, client labels, TUI picker, and frontend source maps gain entries. The deprecated per-client boolean flags intentionally do not, since `antigravity-cli` is reachable only via the canonical `--client antigravity-cli`.

Closes junhoyeo#712.

* fix(sessions): handle file:// authority/UNC paths and test Antigravity CLI wiring

Addresses the cubic review on junhoyeo#713.

`file_uri_to_path` previously stripped `file://` and only special-cased the leading slash before a Windows drive letter, so a non-empty authority (`file://host/share/...`, the UNC form) lost its host and collapsed into a bare path. It now treats an empty-authority remainder as before (`/C:/x` → `C:/x`, `/home/x` kept) and reconstructs a non-empty authority as a UNC path (`host/share/x` → `//host/share/x`) so `normalize_workspace_key` preserves the `//` prefix. A unit test covers the Windows-drive, POSIX, UNC, and percent-encoded-CJK cases.

The new `AntigravityCli` client wiring is now asserted in `test_client_as_str`, `test_client_key`, and `test_client_from_key` (display name "Antigravity CLI", hotkey `f`, and the reverse hotkey mapping).

* style: rustfmt antigravity_cli.rs

* fix(antigravity-cli): add gemini-3-flash-a pricing alias and harden parser tests

Map the raw #19 responseModel `gemini-3-flash-a` onto the priced
`gemini-3-flash-preview` so Antigravity CLI cost no longer resolves to 0.
Add alias-resolution, #9/#10==#3 field-mapping invariant, and
malformed-protobuf bounds tests.

Constraint: must not weaken the junhoyeo#707 brand-token fuzzy-match guard in lookup.rs

Confidence: high

Scope-risk: narrow

---------

Co-authored-by: Junho Yeo <i@junho.io>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant