Skip to content

feat: ?でキーバインド一覧(ヘルプ)を表示 (closes #9)#17

Merged
myuron merged 2 commits into
mainfrom
feat/keybinding-help
Jun 28, 2026
Merged

feat: ?でキーバインド一覧(ヘルプ)を表示 (closes #9)#17
myuron merged 2 commits into
mainfrom
feat/keybinding-help

Conversation

@myuron

@myuron myuron commented Jun 28, 2026

Copy link
Copy Markdown
Owner

概要

issue #9 の対応です。? を押すとキーバインド一覧(ヘルプ)を中央モーダルで表示できるようにしました。

変更点

  • ? でキーバインド一覧を中央モーダル表示(任意キー / Esc / q で閉じる)
  • 一覧は help.gohelpEntries() に定義し、renderHelpModal() で描画
  • ステータスバーに [?]Help を追記、README(日英)にも記載
  • 破壊的変更: ? に割り当てられていた後方検索を廃止
    • 前方検索 /n/N の双方向巡回は維持しているため検索機能自体は利用可能

テスト

  • ? でヘルプ表示 / 任意キーで閉じる / ヘルプ表示中にカーソルが動かない / render にキー一覧を含む、のユニットテストを追加
  • gofmt / golangci-lint(0 issues)/ go test ./...(pass)/ nix build(success)

Closes #9

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • ? でキーバインド一覧のヘルプを中央モーダル表示できるようになりました。
    • ヘルプ表示中は任意キー、Escq で閉じられます。
  • Bug Fixes

    • ? の動作が後方検索ではなくヘルプ表示に変更されました。
    • ヘルプ表示中は通常の操作やカーソル移動が行われないようになりました。
  • Documentation

    • キーバインド一覧にヘルプ表示の案内を追加しました。

issue #9 対応。? を押すと中央モーダルでキーバインド一覧を表示し、
任意キー/Escで閉じる。? に割り当てられていた後方検索は廃止し、
前方検索(/)とn/Nの双方向巡回は維持する。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 28, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

? キーの挙動を後方検索から全画面ヘルプモーダル表示へ変更。InputModeSearchBackward を全面削除し、App 構造体に showHelp bool を追加。help.go を新規作成してモーダル描画を実装し、キー入力ルーティング・レンダリング・テスト・ドキュメントを更新。

Changes

キーバインドヘルプモーダル追加

Layer / File(s) Summary
状態定義とInputModeSearchBackward削除
internal/ui/layout.go
App 構造体に showHelp bool を追加し、InputModeSearchBackward 定数を削除。inputPrefixisTextInputMode から後方検索モードの分岐を除去。
ヘルプモーダル描画実装
internal/ui/help.go
helpEntries() でキー/説明ペア一覧を定義、renderHelpModal()runewidth で列幅を揃え lipgloss 角丸枠付きモーダル文字列を生成。
キー入力ルーティングとtoggleHelp
internal/ui/model.go, internal/ui/keybinding.go
handleKeyshowHelp 優先分岐を追加し handleHelpKey を新規実装。?toggleHelp へ変更。inputSubmit の検索方向を常に forward=true に固定。
render()へのヘルプ分岐とステータスバー更新
internal/ui/render.go
render()showHelp 有効時の早期 return を追加して全画面をヘルプモーダルで置換。renderStatus() のステータス文言を更新。
テストとドキュメント更新
internal/ui/model_test.go, README.md, README_ja.md, .claude/plans/plan.md
後方検索テストを削除し、ヘルプ表示/非表示/カーソル不動/render 出力の 4 テストを追加。README 英語・日本語に ? キーの説明を追記。

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • myuron/graftx#4: InputModeSearchBackwardsearchBackward を導入した入力モードサブシステムが、本 PR で全面削除・置換されているため直接関連する。

Poem

🐇 ? を押せば、ウサギの地図が現れる
後方検索よ、さようなら
角丸の枠の中にキーが並び
どのキーを押せばいいか、もう迷わない
Esc で閉じて、冒険再開! 🗺️

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 16.67% 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
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 主変更である「?でヘルプ表示」を簡潔に示しており、PR内容と一致しています。
Linked Issues check ✅ Passed Issue #9 の「?でキーバインド一覧を見られるようにする」要件を満たしています。
Out of Scope Changes check ✅ Passed README更新、テスト追加、後方検索廃止なども要件に沿った付随変更で、目立つ逸脱はありません。
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/keybinding-help

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.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
internal/ui/model.go (1)

44-57: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

プレビュー中の ? でもヘルプを開けるようにしてください

handleKey() では previewFocusedhandleNormalKey() より先に処理されるため、プレビュー中は ?handlePreviewKey() に吸われます。handlePreviewKey() 側に ? の分岐がないと、この状態からヘルプを開けません。

🤖 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 `@internal/ui/model.go` around lines 44 - 57, `handleKey()` routes preview
focus before normal key handling, so `?` is currently swallowed by
`handlePreviewKey()` and cannot open help while preview is focused. Update
`handlePreviewKey()` in App to recognize `?` and delegate to the same
help-opening path used elsewhere (or route it to `handleHelpKey()`), ensuring
the preview state still allows help access without changing the existing
input-mode ordering.
🤖 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.

Outside diff comments:
In `@internal/ui/model.go`:
- Around line 44-57: `handleKey()` routes preview focus before normal key
handling, so `?` is currently swallowed by `handlePreviewKey()` and cannot open
help while preview is focused. Update `handlePreviewKey()` in App to recognize
`?` and delegate to the same help-opening path used elsewhere (or route it to
`handleHelpKey()`), ensuring the preview state still allows help access without
changing the existing input-mode ordering.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 6e40a3f9-4085-414a-84b3-f7abcb3aa49f

📥 Commits

Reviewing files that changed from the base of the PR and between d989341 and 172b715.

📒 Files selected for processing (9)
  • .claude/plans/plan.md
  • README.md
  • README_ja.md
  • internal/ui/help.go
  • internal/ui/keybinding.go
  • internal/ui/layout.go
  • internal/ui/model.go
  • internal/ui/model_test.go
  • internal/ui/render.go

@myuron
myuron merged commit c1c4159 into main Jun 28, 2026
2 checks passed
@myuron
myuron deleted the feat/keybinding-help branch June 28, 2026 16:24
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.

改善:キーバインディングヘルパーの追加

1 participant