Skip to content

Commit a4c3bef

Browse files
committed
remove merge wizard
1 parent 030cbf7 commit a4c3bef

File tree

4 files changed

+31
-84
lines changed

4 files changed

+31
-84
lines changed

src/diff-preview.js

Lines changed: 7 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ function showPreviewBanner() {
7272
<span class="preview-label">👁 Previewing Patch #<span id="preview-patch-id"></span></span>
7373
<span class="preview-hint">(changes shown inline)</span>
7474
</div>
75-
<div id="conflict-tabs"></div>
7675
<div class="preview-controls">
7776
<button class="restore-btn" title="Restore document to this patch version">↺ Restore</button>
7877
<button class="exit-btn">✕ Exit Preview</button>
@@ -106,9 +105,6 @@ function showPreviewBanner() {
106105
patchIdEl.textContent = previewState.patchId;
107106
}
108107

109-
// Update conflict tabs if in a conflict group
110-
updateConflictTabs();
111-
112108
banner.style.display = 'flex';
113109
}
114110

@@ -163,12 +159,9 @@ function renderGhostPreview() {
163159
let toPm = charToPm(toChar);
164160

165161
// Debug
166-
console.log(`[GhostPreview] Delete: MD ${fromChar}-${toChar} -> PM ${fromPm}-${toPm}, text: "${op.text.substring(0, 30)}..."`);
167-
168162
// Ensure minimum range of 1 for non-empty deletes
169163
if (op.text.length > 0 && toPm <= fromPm) {
170164
toPm = fromPm + 1;
171-
console.log(`[GhostPreview] Adjusted toPm to ${toPm} for minimum range`);
172165
}
173166

174167
if (fromPm < toPm) {
@@ -185,7 +178,7 @@ function renderGhostPreview() {
185178
const posPm = charToPm(oldOffset);
186179

187180
// Debug
188-
console.log(`[GhostPreview] Add: MD offset ${oldOffset} -> PM ${posPm}, text: "${op.text.substring(0, 30)}..."`);
181+
189182

190183
operations.push({
191184
type: 'add',
@@ -197,7 +190,7 @@ function renderGhostPreview() {
197190
}
198191

199192
// Debug final operations
200-
console.log(`[GhostPreview] Final operations:`, operations);
193+
201194

202195
// Apply the decorations to the editor
203196
showDiffPreview(operations);
@@ -261,62 +254,12 @@ async function getPendingConflictPatchIds(excludePatchId = null) {
261254
/**
262255
* Update the conflict tabs in the preview banner
263256
*/
257+
/**
258+
* Update the conflict tabs in the preview banner - Disabled
259+
*/
264260
async function updateConflictTabs() {
265-
const tabsContainer = document.getElementById('conflict-tabs');
266-
if (!tabsContainer) return;
267-
268-
// Clear existing tabs
269-
tabsContainer.innerHTML = '';
270-
271-
// Only show tabs if in a conflict group with multiple patches
272-
if (!previewState.conflictGroup || previewState.conflictGroup.length <= 1) {
273-
return;
274-
}
275-
276-
// Get pending patches in the conflict group
277-
const pendingPatchIds = await getPendingConflictPatchIds();
278-
279-
// Only show tabs if there are multiple pending patches
280-
if (pendingPatchIds.length <= 1) {
281-
return;
282-
}
283-
284-
// Show warning indicator
285-
const warningDiv = document.createElement('div');
286-
warningDiv.className = 'conflict-warning-header';
287-
warningDiv.innerHTML = '⚠️ Conflicting patches:';
288-
warningDiv.style.cssText = 'color:#f44336;font-weight:bold;font-size:0.9rem;margin-right:8px;';
289-
tabsContainer.appendChild(warningDiv);
290-
291-
// Create tabs for each pending patch in the conflict group
292-
for (const patchId of pendingPatchIds) {
293-
const tab = document.createElement('button');
294-
tab.className = 'conflict-tab';
295-
tab.dataset.patchId = patchId;
296-
tab.textContent = `#${patchId}`;
297-
298-
if (patchId === previewState.patchId) {
299-
tab.classList.add('active');
300-
}
301-
302-
tab.addEventListener('click', async () => {
303-
await switchToConflictPatch(patchId);
304-
});
305-
306-
tabsContainer.appendChild(tab);
307-
}
308-
309-
// Add "Resolve Conflict" button
310-
const resolveBtn = document.createElement('button');
311-
resolveBtn.className = 'resolve-conflict-btn';
312-
resolveBtn.innerHTML = '🔀 Merge';
313-
resolveBtn.style.cssText = 'margin-left:12px;background:linear-gradient(135deg,#667eea 0%,#764ba2 100%);color:white;border:none;padding:6px 12px;border-radius:4px;cursor:pointer;font-weight:600;font-size:11px;';
314-
resolveBtn.addEventListener('click', async () => {
315-
exitPreview();
316-
const { openPatchMergeWizardWithPatches } = await import('./patch-merge-wizard.js');
317-
openPatchMergeWizardWithPatches(pendingPatchIds);
318-
});
319-
tabsContainer.appendChild(resolveBtn);
261+
// Conflict tabs and merge wizard disabled per user request
262+
return;
320263
}
321264

322265
/**

src/editor.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -323,12 +323,12 @@ export function scrollToEditorRange(from, to) {
323323
try {
324324
// Safeguard against out of bounds
325325
const safeFrom = Math.min(from, view.state.doc.content.size);
326-
console.log(`[Scroll] Scrolling to PM position: ${safeFrom}`);
326+
327327

328328
// Get the DOM coordinates for the position
329329
const coords = view.coordsAtPos(safeFrom);
330330
if (coords) {
331-
console.log(`[Scroll] Coords:`, coords);
331+
332332

333333
// Find the scroll container
334334
const scrollContainer = document.querySelector('.editor-scroll') ||
@@ -345,7 +345,7 @@ export function scrollToEditorRange(from, to) {
345345
top: Math.max(0, targetY - centerOffset),
346346
behavior: 'smooth'
347347
});
348-
console.log(`[Scroll] Scrolled to Y: ${targetY - centerOffset}`);
348+
349349
}
350350
}
351351

@@ -526,7 +526,7 @@ export function previewHunkWithDiff(hunkType, baseStart, baseEnd, modifiedText,
526526
// Use coordinate mapping - maps markdown offsets directly to PM positions
527527
const { charToPm } = getMarkdownToPmMapping();
528528

529-
console.log(`[HunkPreview] Type: ${hunkType}, BaseStart: ${baseStart}, BaseEnd: ${baseEnd}`);
529+
530530

531531
const operations = [];
532532

@@ -535,7 +535,7 @@ export function previewHunkWithDiff(hunkType, baseStart, baseEnd, modifiedText,
535535
const fromPm = charToPm(baseStart);
536536
const toPm = charToPm(baseEnd);
537537

538-
console.log(`[HunkPreview] Delete: MD ${baseStart}-${baseEnd} -> PM ${fromPm}-${toPm}`);
538+
539539

540540
if (fromPm < toPm) {
541541
operations.push({
@@ -555,7 +555,7 @@ export function previewHunkWithDiff(hunkType, baseStart, baseEnd, modifiedText,
555555
// Map the insertion point directly
556556
const posPm = charToPm(baseStart);
557557

558-
console.log(`[HunkPreview] Add: MD ${baseStart} -> PM ${posPm}, text: "${modifiedText.substring(0, 30)}..."`);
558+
559559

560560
operations.push({
561561
type: 'add',
@@ -567,7 +567,7 @@ export function previewHunkWithDiff(hunkType, baseStart, baseEnd, modifiedText,
567567
const fromPm = charToPm(baseStart);
568568
const toPm = charToPm(baseEnd);
569569

570-
console.log(`[HunkPreview] Modify: MD ${baseStart}-${baseEnd} -> PM ${fromPm}-${toPm}`);
570+
571571

572572
// Delete the old text
573573
if (fromPm < toPm) {
@@ -588,7 +588,7 @@ export function previewHunkWithDiff(hunkType, baseStart, baseEnd, modifiedText,
588588
}
589589
}
590590

591-
console.log(`[HunkPreview] Final operations:`, operations);
591+
592592

593593
if (operations.length > 0) {
594594
showDiffPreview(operations);

src/mapping-logic.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,19 +54,19 @@ export function computeBlockMapping(doc, serializer) {
5454
});
5555

5656
// Debug Block Map
57-
console.log("[BlockMap] Built Map:", blockMap);
57+
5858

5959
return {
6060
blockMap,
6161
charToPm: (mdOffset) => {
62-
console.log(`[BlockMap] Mapping Offset: ${mdOffset}`);
62+
6363

6464
// Find the block containing this offset
6565
// We use >= start and <= end to capture the trailing edge.
6666
const block = blockMap.find(b => mdOffset >= b.mdStart && mdOffset <= b.mdEnd);
6767

6868
if (block) {
69-
console.log(`[BlockMap] Hit Block:`, block);
69+
7070
// We are inside a block.
7171
const relativeMd = mdOffset - block.mdStart;
7272

@@ -81,7 +81,7 @@ export function computeBlockMapping(doc, serializer) {
8181
// console.log(`[BlockMap] Ratio: ${relativeMd}/${block.mdEnd - block.mdStart} = ${relativeRatio}`);
8282

8383
const result = Math.floor(contentStart + (relativeRatio * contentSize));
84-
console.log(`[BlockMap] Mapped to PM: ${result}`);
84+
return result;
8585
return result;
8686
}
8787

@@ -96,24 +96,24 @@ export function computeBlockMapping(doc, serializer) {
9696

9797
if (prevBlock) {
9898
if (mdOffset > prevBlock.mdEnd) {
99-
console.log(`[BlockMap] Gap! Attaching to PrevBlock:`, prevBlock);
99+
100100

101101
// Fix: End of Document
102102
// If this is the last block, and we are appending AFTER it, map to doc end.
103103
if (prevBlock === blockMap[blockMap.length - 1]) {
104-
console.log(`[BlockMap] End of Doc detected. Mapping to Doc Size.`);
104+
// End of document detected
105105
return doc.content.size;
106106
}
107107

108108
const result = Math.max(prevBlock.pmStart + 1, prevBlock.pmEnd - 1);
109-
console.log(`[BlockMap] Gap Result: ${result}`);
109+
110110
return result;
111111
}
112112
}
113113

114114
const nextBlock = blockMap.find(b => mdOffset < b.mdStart);
115115
if (nextBlock) {
116-
console.log(`[BlockMap] Fallback to Next Block:`, nextBlock);
116+
117117

118118
// Fix: Offset 0 (Start of Doc)
119119
// If mapping to first block, force "Inside" logic.

src/timeline.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,8 @@ export async function renderPatchList(patches) {
256256
const list = document.getElementById("timeline-list");
257257
list.innerHTML = "";
258258

259-
// Detect conflicts in patches
260-
conflictState = detectPatchConflicts(patches);
259+
// Detect conflicts in patches - Disabled per user request
260+
// conflictState = detectPatchConflicts(patches);
261261

262262
// Reset the flag (we no longer show alerts, conflicts are visible in timeline)
263263

@@ -431,18 +431,22 @@ export async function renderPatchList(patches) {
431431
}
432432
}
433433

434-
// Check if this patch is in conflict
435-
const hasConflict = isInConflict(patch.id, conflictState.patchConflicts);
434+
// Check if this patch is in conflict - Disabled
435+
const hasConflict = false; // isInConflict(patch.id, conflictState.patchConflicts);
436+
/*
436437
if (hasConflict) {
437438
div.classList.add("has-conflict");
438439
}
440+
*/
439441

440442
// Get conflict info
441443
let conflictInfo = '';
444+
/*
442445
if (hasConflict) {
443446
const conflictingIds = conflictState.patchConflicts.get(patch.id) || [];
444447
conflictInfo = formatConflictInfo(patch.id, conflictingIds);
445448
}
449+
*/
446450

447451

448452

0 commit comments

Comments
 (0)