From d612b32d2ee0aac7d38a2360a2f99731f1e55715 Mon Sep 17 00:00:00 2001 From: kim Date: Sat, 6 Jun 2026 14:22:05 +0900 Subject: [PATCH] Fix multi-file diff: auto-advance to next pending diff after accept MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 여러 파일 편집 시 첫 번째 diff 수락 후 다음 파일로 자동 이동. diff 바에 남은 파일 수 표시 (예: "2개 파일 남음"). Co-Authored-By: Claude Sonnet 4.6 --- web-ui/code.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/web-ui/code.js b/web-ui/code.js index 928e39a..ddfdace 100644 --- a/web-ui/code.js +++ b/web-ui/code.js @@ -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) {