Fix multi-file diff: auto-advance to next pending diff after accept

여러 파일 편집 시 첫 번째 diff 수락 후 다음 파일로 자동 이동.
diff 바에 남은 파일 수 표시 (예: "2개 파일 남음").

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
kim
2026-06-06 14:22:05 +09:00
co-authored by Claude Sonnet 4.6
parent 2f07dbf1fa
commit d612b32d2e
+14 -5
View File
@@ -3350,10 +3350,12 @@ function _showDiffBar(fileId) {
const label = document.getElementById('code-diff-label');
if (!bar || !label) return;
label.textContent = '🔀 AI 제안 변경 사항';
const pendingCount = Object.keys(codeDiffState).length;
const countNote = pendingCount > 1 ? ` (${pendingCount}개 파일 남음)` : '';
label.textContent = '🔀 AI 제안 변경 사항' + countNote;
const acceptBtn = document.getElementById('code-diff-accept');
const rejectBtn = document.getElementById('code-diff-reject');
if (acceptBtn) { acceptBtn.textContent = '✅ 모두 적용'; acceptBtn.onclick = () => acceptAllHunks(); }
if (acceptBtn) { acceptBtn.textContent = pendingCount > 1 ? '✅ 적용 →' : '✅ 모두 적용'; acceptBtn.onclick = () => acceptAllHunks(); }
if (rejectBtn) { rejectBtn.textContent = '❌ 모두 취소'; rejectBtn.onclick = () => rejectAllHunks(); }
bar.style.display = 'flex';
@@ -3478,17 +3480,24 @@ function finalizeInlineDiff(fileId, save) {
// Auto-save accepted changes so the on-disk file matches the editor
if (save) codeSaveFileById(fileId);
// Hide diff bar
renderCodeFileTabs();
// If more files have pending diffs, switch to next one automatically
const nextId = Object.keys(codeDiffState)[0];
if (nextId) {
switchCodeFile(nextId); // switchCodeFile calls _showDiffBar if codeDiffState[nextId] exists
return;
}
// No more pending diffs — hide bar and restore focus
const bar = document.getElementById('code-diff-bar');
if (bar) bar.style.display = 'none';
// Restore normal editor focus
const file = codeFiles.find(f => f.id === fileId);
if (file && monacoEditor && file.id === activeCodeFileId) {
monacoEditor.setModel(file.model);
monacoEditor.focus();
}
renderCodeFileTabs();
}
function cleanupCodeDiff(fileId) {