Skip to content

fix(desktop): ターミナルサジェストのはみ出し防止とAgent操作中の非表示化#31

Merged
MocA-Love merged 4 commits intomainfrom
fix/desktop-terminal-suggestion-bugs
Mar 30, 2026
Merged

fix(desktop): ターミナルサジェストのはみ出し防止とAgent操作中の非表示化#31
MocA-Love merged 4 commits intomainfrom
fix/desktop-terminal-suggestion-bugs

Conversation

@MocA-Love
Copy link
Copy Markdown
Owner

@MocA-Love MocA-Love commented Mar 30, 2026

Summary

  • [bug] ターミナルサジェストがはみ出てしまう #29: サジェストドロップダウンがターミナル下部からはみ出す場合、カーソルの上側に表示するよう位置計算を修正
  • [bug] ClaudeなどのAgent使ってる時にもサジェスト出てきてしまう #30: alternate screen(Claude Code等のTUIアプリ)中のサジェスト表示を4層で完全抑制
    • 入力蓄積防止: キー入力・ペーストの両方でalternate screenチェック
    • ポーリング防止: refを直接渡して150msポーリング内でチェック(React再レンダリングに依存しない)
    • フェッチ防止: API呼び出し前にも同チェック
    • 描画防止: xterm.buffer.active.type === "alternate" で最終ブロック
  • 日本語文字化け修正: zshのmetafiedエンコーディング(0x83マーカー)をデコードして正常表示
  • upstream/main を取り込み、コンフリクトを解消

Test plan

  • ターミナル下部でコマンド入力時、サジェストが上側に表示されることを確認
  • Claude Code等のTUIアプリ実行中にサジェストが表示されないことを確認
  • 通常のターミナルでサジェストが正常に動作することを確認
  • 日本語を含むコマンド履歴が文字化けせず表示されることを確認

Closes #29, Closes #30

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 30, 2026

Warning

Rate limit exceeded

@MocA-Love has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 2 minutes and 46 seconds before requesting another review.

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 2 minutes and 46 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2cd90554-0bce-477b-b656-e23a342d4eac

📥 Commits

Reviewing files that changed from the base of the PR and between a3c4f58 and b7f87d3.

📒 Files selected for processing (5)
  • apps/desktop/src/main/lib/shell-history.ts
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/Terminal.tsx
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/TerminalSuggestion/TerminalSuggestion.tsx
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/hooks/useTerminalLifecycle.ts
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/hooks/useTerminalSuggestion.ts
📝 Walkthrough

Walkthrough

The pull request fixes two terminal suggestion feature bugs: preventing the dropdown from overflowing past the viewport by implementing dynamic above/below positioning logic, and disabling suggestions during workspaceRun Agent operations. README documentation is updated accordingly.

Changes

Cohort / File(s) Summary
Documentation
README.md
Added new table entry documenting the suggestion bug fixes (PR #31, 2026-03-30).
Suggestion Gating
apps/desktop/src/renderer/screens/main/components/WorkspaceView/.../Terminal.tsx
Added !isWorkspaceRunPane condition to disable terminal suggestions when Agent (workspaceRun) operations are active.
Dropdown Positioning
apps/desktop/src/renderer/screens/main/components/WorkspaceView/.../TerminalSuggestion.tsx
Replaced fixed dropdown positioning with dynamic logic that calculates terminal viewport height, estimates dropdown dimensions, and conditionally positions dropdown above or below the cursor to prevent overflow.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 A dropdown that danced beyond the screen's edge,
Now floats with grace, positioning on a careful ledge,
When Claude runs wild, suggestions take a rest,
Terminal whispers grow silent—a thoughtful jest! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the two main changes: preventing terminal suggestion dropdown overflow and disabling suggestions during Agent operations.
Linked Issues check ✅ Passed Code changes directly address both linked issues: Terminal suggestion position logic modified for #29 and workspaceRun pane gating added for #30.
Out of Scope Changes check ✅ Passed All changes are scoped to the two linked issues: Terminal suggestion positioning fix, workspaceRun condition gating, and README documentation update.
Description check ✅ Passed The PR description provides a comprehensive summary of changes addressing two specific issues (#29, #30) with clear implementation details, test plans, and related issue links.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/desktop-terminal-suggestion-bugs

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.

@MocA-Love MocA-Love self-assigned this Mar 30, 2026
- #29: ドロップダウンがターミナル下部からはみ出す場合、カーソル上側に表示
- #30: workspaceRunペインではサジェストを無効化
@MocA-Love MocA-Love force-pushed the fix/desktop-terminal-suggestion-bugs branch from e6a89d6 to a3c4f58 Compare March 30, 2026 07:34
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

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 the current code and only fix it if needed.

Inline comments:
In
`@apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/TerminalSuggestion/TerminalSuggestion.tsx`:
- Around line 68-84: The dropdown height is currently computed from fixed
PREVIEW_HEIGHT/FOOTER_HEIGHT and ITEM_HEIGHT which can overflow; instead measure
the actual preview DOM height (use the preview element's
offsetHeight/scrollHeight) and compute a measuredPreviewHeight, then recompute
dropdownHeight = measuredPreviewHeight + FOOTER_HEIGHT +
Math.min(suggestions.length, MAX_VISIBLE_ITEMSAdjusted) * ITEM_HEIGHT where
MAX_VISIBLE_ITEMSAdjusted is clamped to available space (based on
terminalHeight, TERMINAL_PADDING, cursorY and dims.height) so the list height is
reduced to fit; finally use this clamped dropdownHeight when computing
spaceBelow and dropdownTop so the menu never extends out of bounds.
🪄 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: defaults

Review profile: CHILL

Plan: Pro

Run ID: 446f074d-f6c9-4d75-9d42-9db7769275f6

📥 Commits

Reviewing files that changed from the base of the PR and between c370254 and a3c4f58.

📒 Files selected for processing (3)
  • README.md
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/Terminal.tsx
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/TerminalSuggestion/TerminalSuggestion.tsx

- useTerminalSuggestion: isAlternateScreenRefをrefとして直接受け取りポーリング内でチェック
- useTerminalLifecycle: alternate screen中はcommandBufferへのキー入力・ペースト蓄積を防止
- TerminalSuggestion: xterm.buffer.active.type === "alternate" で描画を最終ブロック
- shell-history: zshのmetafiedエンコーディングをデコードして日本語文字化けを解消
@MocA-Love MocA-Love merged commit 8e3955e into main Mar 30, 2026
13 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] ClaudeなどのAgent使ってる時にもサジェスト出てきてしまう [bug] ターミナルサジェストがはみ出てしまう

1 participant