Skip to content

FudeReviewPanel: 開いているファイルにマーカー表示&カーソル追従#152

Merged
kyu08 merged 4 commits into
mainfrom
feat/sidepanel-current-file-marker
Jun 19, 2026
Merged

FudeReviewPanel: 開いているファイルにマーカー表示&カーソル追従#152
kyu08 merged 4 commits into
mainfrom
feat/sidepanel-current-file-marker

Conversation

@kyu08

@kyu08 kyu08 commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

概要

サイドパネルのFilesセクションで、現在開いているファイルに マーカーを表示し、バッファ切り替え時にサイドパネルのカーソルが自動的に追従するようにする。

Closes #130

変更内容

  • format_files_section/format_files_section_treecurrent_path引数を追加し、現在のファイルにマーカー(DiagnosticInfoハイライト)を表示
  • render()内でfind_target_window+make_relativeを使い現在のファイルパスを計算、マーカーの対象行番号をpanel.current_file_lineに格納
  • follow_current_file()メソッドを追加:re-renderした後、カーソルを現在のファイルエントリに移動
  • BufEnter autocmdからfollow_current_file()を呼び出し、バッファ切替時にサイドパネルのカーソルが追従するように(サイドパネルバッファ自体への BufEnter はスキップ)
  • flat/tree両モードに対応

テスト計画

  • 既存テスト全パス (make all)
  • 新規テスト追加: tests/fude/sidepanel_spec.lua(flatモード5件、treeモード3件)
  • 手動確認: PRレビューモードでサイドパネルを開き、ファイルを切り替えた際にマーカーとカーソルが追従することを確認

Generated with Claude Code

kyu08 and others added 3 commits June 18, 2026 13:41
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 18, 2026 05:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

サイドパネル(:FudeReviewPanel)の Files セクションで、現在開いているファイルを マーカーで可視化し、バッファ切替(BufEnter)に合わせてサイドパネルのカーソルが自動追従するようにする変更です。ui/sidepanel.lua の表示フォーマット拡張と、init.lua の BufEnter フック追加、ならびにそれらのテスト・ドキュメント更新が含まれます。

Changes:

  • format_files_section / format_files_section_treecurrent_path を追加し、現在ファイル行に DiagnosticInfo ハイライトを付与
  • ui/sidepanel.luafollow_current_file() を追加し、再描画後に現在ファイル行へカーソル移動するよう実装
  • BufEnter autocmd から追従を起動するようにし、仕様を doc/fude.txtCLAUDE.md に反映、テストを追加

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/fude/sidepanel_spec.lua current_path 指定時の 表示とハイライト付与(flat/tree)のテストを追加
lua/fude/ui/sidepanel.lua 現在ファイルマーカー表示・追従用の current_path 計算と follow_current_file() を追加
lua/fude/init.lua BufEnter で extmarks/keymaps 更新に加えて sidepanel の追従更新を実行
doc/fude.txt パネルがバッファ切替で追従し、 マーカーが付くことを追記
CLAUDE.md ui/sidepanel.lua の関数シグネチャ/責務説明と state 参照関係を更新

Comment thread lua/fude/ui/sidepanel.lua
Comment on lines +317 to +321
-- Determine current file path for marker
local current_path = nil
if repo_root then
local target_win = M.find_target_window(panel.win)
if target_win then

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

3dcab4b で修正 — open() 時に panel.repo_root をキャッシュし、render() でのサブプロセス呼び出しを排除しました。

Comment thread lua/fude/ui/sidepanel.lua
Comment on lines +319 to +329
if repo_root then
local target_win = M.find_target_window(panel.win)
if target_win then
local target_buf = vim.api.nvim_win_get_buf(target_win)
local buf_name = vim.api.nvim_buf_get_name(target_buf)
if buf_name and buf_name ~= "" then
local abs_path = vim.fn.fnamemodify(buf_name, ":p")
current_path = diff_mod.make_relative(abs_path, repo_root)
end
end
end

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

3dcab4b で修正 — nvim_get_current_win() を優先し、panel/preview以外の通常ウィンドウならそのまま使用、それ以外の場合のみ find_target_window() にフォールバックするようにしました。

Comment thread lua/fude/init.lua
Comment on lines 313 to 317
vim.api.nvim_create_autocmd("BufEnter", {
group = state.augroup,
callback = function()
vim.schedule(function()
require("fude.ui").refresh_extmarks()

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

3dcab4b で修正 — ev.bufvim.schedule() の前にキャプチャし、sidepanelガードで使用するようにしました。

…rent win, capture ev.buf)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@kyu08 kyu08 marked this pull request as ready for review June 19, 2026 01:46
@kyu08 kyu08 requested a review from flexphere as a code owner June 19, 2026 01:46
Copilot AI review requested due to automatic review settings June 19, 2026 01:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.

@kyu08 kyu08 merged commit 995536d into main Jun 19, 2026
10 checks passed
@kyu08 kyu08 deleted the feat/sidepanel-current-file-marker branch June 19, 2026 02:02
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.

FudeReviewPanel: 開いているファイルをわかりやすくする

2 participants