FudeReviewPanel: 開いているファイルにマーカー表示&カーソル追従#152
Merged
Merged
Conversation
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>
Contributor
There was a problem hiding this comment.
Pull request overview
サイドパネル(:FudeReviewPanel)の Files セクションで、現在開いているファイルを ▶ マーカーで可視化し、バッファ切替(BufEnter)に合わせてサイドパネルのカーソルが自動追従するようにする変更です。ui/sidepanel.lua の表示フォーマット拡張と、init.lua の BufEnter フック追加、ならびにそれらのテスト・ドキュメント更新が含まれます。
Changes:
format_files_section/format_files_section_treeにcurrent_pathを追加し、現在ファイル行に▶とDiagnosticInfoハイライトを付与ui/sidepanel.luaにfollow_current_file()を追加し、再描画後に現在ファイル行へカーソル移動するよう実装- BufEnter autocmd から追従を起動するようにし、仕様を
doc/fude.txtとCLAUDE.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 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 |
Collaborator
Author
There was a problem hiding this comment.
3dcab4b で修正 — open() 時に panel.repo_root をキャッシュし、render() でのサブプロセス呼び出しを排除しました。
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 |
Collaborator
Author
There was a problem hiding this comment.
3dcab4b で修正 — nvim_get_current_win() を優先し、panel/preview以外の通常ウィンドウならそのまま使用、それ以外の場合のみ find_target_window() にフォールバックするようにしました。
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() |
Collaborator
Author
There was a problem hiding this comment.
3dcab4b で修正 — ev.buf を vim.schedule() の前にキャプチャし、sidepanelガードで使用するようにしました。
…rent win, capture ev.buf) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
サイドパネルのFilesセクションで、現在開いているファイルに
▶マーカーを表示し、バッファ切り替え時にサイドパネルのカーソルが自動的に追従するようにする。Closes #130
変更内容
format_files_section/format_files_section_treeにcurrent_path引数を追加し、現在のファイルに▶マーカー(DiagnosticInfoハイライト)を表示render()内でfind_target_window+make_relativeを使い現在のファイルパスを計算、マーカーの対象行番号をpanel.current_file_lineに格納follow_current_file()メソッドを追加:re-renderした後、カーソルを現在のファイルエントリに移動follow_current_file()を呼び出し、バッファ切替時にサイドパネルのカーソルが追従するように(サイドパネルバッファ自体への BufEnter はスキップ)テスト計画
make all)tests/fude/sidepanel_spec.lua(flatモード5件、treeモード3件)Generated with Claude Code