Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rotate panes #496

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,11 @@ <h1 class="warning">Network is down</h1>
<button type="button" aria-label="Close Pane" data-sc="D" id="trash-button" class="pane-buttons off has-help"><i class="f7-icons">rectangle_badge_xmark</i></button>
<button type="button" aria-label="Split Right to Left" data-sc="'" id="divide-h" class="pane-buttons off has-help"><i class="f7-icons">divide</i></button>
<button type="button" aria-label="Split Top to Bottom" data-sc="\" id="divide-v" class="pane-buttons off has-help">
<i class="f7-icons" style="display: inline-block; transform: rotate(90deg);">divide</i></button>
<i class="f7-icons" style="display: inline-block; transform: rotate(90deg);">divide</i>
</button>
<button type="button" aria-label="Rotate active layout" data-sc="⇧ R" id="rotate-layout" class="pane-buttons off has-help">
<i class="f7-icons">arrow_clockwise</i>
</button>
<button type="button" aria-label="Search Pane Buffer" data-sc="F" id="search-button" class="pane-buttons off has-help"><i class="f7-icons">doc_text_search</i></button>
<button type="button" aria-label="Video" id="video-button" class="pane-buttons off has-help"><i class="f7-icons">videocam</i></button>
<button type="button" aria-label="Help" id="help-button" class="has-help"><i class="f7-icons">question</i></button>
Expand Down
56 changes: 56 additions & 0 deletions src/layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -363,4 +363,60 @@ export class Layout extends Cell {
})
return cells
}
changeDir(){
if(this.dir === "TBD") return;
const parentDir = this.layout?.dir
const newDir = this.dir === 'rightleft' ? 'topbottom' : 'rightleft'
let keepXoff = false;
let keepYoff = false;
let cellSize;
console.log('origdir',this.dir)
if(this.dir === 'topbottom'){
keepYoff = true
cellSize = this.sy / this.cells.length
}else if(this.dir === 'rightleft') {
keepXoff = true
cellSize = this.sx / this.cells.length
}
this.cells.forEach((c, i) => {
const oldXoff = c.xoff
const oldYoff = c.yoff
const oldSx = c.sx;
const oldSy = c.sy;
c.yoff = oldXoff
c.xoff = oldYoff
c.sx = oldSy
c.sy = oldSx
// console.log('c',{
// xoff: c.xoff,
// yoff: c.yoff,
// sx: c.sx,
// sy: c.sy,
// })
if(keepYoff){
c.yoff = this.yoff + cellSize * i
c.xoff = this.xoff
c.sy = cellSize
c.sx = this.sx
}else if(keepXoff){
c.yoff = this.yoff
c.xoff = this.xoff + cellSize * i
c.sy = this.sy
c.sx = cellSize
}
// console.log('c2',{
// xoff: c.xoff,
// yoff: c.yoff,
// sx: c.sx,
// sy: c.sy,
// })
});
this.dir = newDir
this.refreshDividers()
if(this.dir === parentDir){
const replaceIndex = this.layout.cells.findIndex(c => c.id === this.id)
this.layout.cells.splice(replaceIndex, 1, ...this.cells)
Comment on lines +417 to +418
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Handle case where findIndex returns -1 to avoid unexpected behavior

At lines 417-418, findIndex may return -1 if the current layout's id is not found in this.layout.cells. Using -1 as the start index in splice could remove the last element of the array unintentionally. Ensure that replaceIndex is valid before proceeding with the splice operation.

Apply this diff to check the validity of replaceIndex:

            const replaceIndex = this.layout.cells.findIndex(c => c.id === this.id)
+           if (replaceIndex !== -1) {
                this.layout.cells.splice(replaceIndex, 1, ...this.cells)
                this.layout.refreshDividers()
+           } else {
+               // Handle the case where the layout was not found
+               console.error('Current layout not found in parent layout cells.')
+           }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const replaceIndex = this.layout.cells.findIndex(c => c.id === this.id)
this.layout.cells.splice(replaceIndex, 1, ...this.cells)
const replaceIndex = this.layout.cells.findIndex(c => c.id === this.id)
if (replaceIndex !== -1) {
this.layout.cells.splice(replaceIndex, 1, ...this.cells)
this.layout.refreshDividers()
} else {
// Handle the case where the layout was not found
console.error('Current layout not found in parent layout cells.')
}

this.layout.refreshDividers()
}
Comment on lines +416 to +420
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Prevent potential runtime error when this.layout is undefined

In the conditional block starting at line 416, accessing this.layout.cells without ensuring that this.layout is defined can lead to a TypeError if this.layout is undefined. This can occur when the current layout has no parent layout. To prevent this, add a null check for this.layout before accessing its properties.

Apply this diff to add a null check:

        this.dir = newDir
        this.refreshDividers()
-       if(this.dir === parentDir){
+       if(this.dir === parentDir && this.layout){
            const replaceIndex = this.layout.cells.findIndex(c => c.id === this.id)
            this.layout.cells.splice(replaceIndex, 1, ...this.cells)
            this.layout.refreshDividers()
        }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if(this.dir === parentDir){
const replaceIndex = this.layout.cells.findIndex(c => c.id === this.id)
this.layout.cells.splice(replaceIndex, 1, ...this.cells)
this.layout.refreshDividers()
}
if(this.dir === parentDir && this.layout){
const replaceIndex = this.layout.cells.findIndex(c => c.id === this.id)
this.layout.cells.splice(replaceIndex, 1, ...this.cells)
this.layout.refreshDividers()
}

}
Comment on lines +366 to +421
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Recommend adding unit tests for the new changeDir method

The changeDir method introduces significant new functionality that manipulates the layout of cells. To ensure correctness and prevent regressions, it's advisable to add unit tests covering various scenarios, such as:

  • Rotating layouts with different numbers of cells.
  • Handling nested layouts.
  • Verifying that cells retain expected properties after rotation.

}
39 changes: 34 additions & 5 deletions src/pane.ts
Original file line number Diff line number Diff line change
Expand Up @@ -563,23 +563,52 @@ export class Pane extends Cell {
f = () => this.gate.newTab()
break
case "r":
f = () => this.gate.reset()
if(ev.shiftKey){
this.layout.cells.forEach(c => console.log(c))
f = () => this.layout.changeDir()
Comment on lines +566 to +568
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Remove debugging console.log statement in Shift+R handler

The console.log statement inside the Shift+R handler appears to be leftover debugging code. Removing it will clean up the console output in production.

Apply this diff to remove the unnecessary console.log call:

if (ev.shiftKey) {
-    this.layout.cells.forEach(c => console.log(c));
    f = () => this.layout.changeDir();
} else {
    f = () => this.gate.reset();
}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if(ev.shiftKey){
this.layout.cells.forEach(c => console.log(c))
f = () => this.layout.changeDir()
if(ev.shiftKey){
f = () => this.layout.changeDir()

}else {
f = () => this.gate.reset()
}
break
// this key is at terminal level
case "l":
f = () => this.t7.map.showLog()
break
case "ArrowLeft":
f = () => this.w.moveFocus("left")
if(ev.shiftKey){
const pane = this.w.getPane("left")
if(!pane) return;
this.w.swapPanes(this,pane)
}else {
f = () => this.w.moveFocus("left")
}
Comment on lines +578 to +584
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Provide user feedback when no pane exists to swap with on Shift+ArrowLeft

When Shift+ArrowLeft is pressed and there is no pane to the left, the function returns silently. Consider notifying the user to improve the user experience.

Apply this diff to inform the user when no adjacent pane is available:

if (ev.shiftKey) {
    const pane = this.w.getPane("left");
    if (!pane) {
+       this.gate.notify("No pane to the left to swap with.");
        return;
    }
    this.w.swapPanes(this, pane);
} else {
    f = () => this.w.moveFocus("left");
}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if(ev.shiftKey){
const pane = this.w.getPane("left")
if(!pane) return;
this.w.swapPanes(this,pane)
}else {
f = () => this.w.moveFocus("left")
}
if(ev.shiftKey){
const pane = this.w.getPane("left")
if(!pane) {
this.gate.notify("No pane to the left to swap with.");
return;
}
this.w.swapPanes(this,pane)
}else {
f = () => this.w.moveFocus("left")
}

break
case "ArrowRight":
f = () => this.w.moveFocus("right")
if(ev.shiftKey){
const pane = this.w.getPane("right")
if(!pane) return;
this.w.swapPanes(this,pane)
}else {
f = () => this.w.moveFocus("right")
}
Comment on lines +587 to +593
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Provide user feedback when no pane exists to swap with on Shift+ArrowRight

Similar to the left direction, inform the user when there's no pane to the right to swap with.

Apply this diff:

if (ev.shiftKey) {
    const pane = this.w.getPane("right");
    if (!pane) {
+       this.gate.notify("No pane to the right to swap with.");
        return;
    }
    this.w.swapPanes(this, pane);
} else {
    f = () => this.w.moveFocus("right");
}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if(ev.shiftKey){
const pane = this.w.getPane("right")
if(!pane) return;
this.w.swapPanes(this,pane)
}else {
f = () => this.w.moveFocus("right")
}
if(ev.shiftKey){
const pane = this.w.getPane("right")
if(!pane) {
this.gate.notify("No pane to the right to swap with.");
return;
}
this.w.swapPanes(this,pane)
}else {
f = () => this.w.moveFocus("right")
}

break
case "ArrowUp":
f = () => this.w.moveFocus("up")
if(ev.shiftKey){
const pane = this.w.getPane("up")
if(!pane) return;
this.w.swapPanes(this,pane)
}else {
f = () => this.w.moveFocus("up")
}
Comment on lines +596 to +602
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Provide user feedback when no pane exists to swap with on Shift+ArrowUp

When swapping panes upward, notify the user if no pane is available above.

Apply this diff:

if (ev.shiftKey) {
    const pane = this.w.getPane("up");
    if (!pane) {
+       this.gate.notify("No pane above to swap with.");
        return;
    }
    this.w.swapPanes(this, pane);
} else {
    f = () => this.w.moveFocus("up");
}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if(ev.shiftKey){
const pane = this.w.getPane("up")
if(!pane) return;
this.w.swapPanes(this,pane)
}else {
f = () => this.w.moveFocus("up")
}
if(ev.shiftKey){
const pane = this.w.getPane("up")
if(!pane) {
this.gate.notify("No pane above to swap with.");
return;
}
this.w.swapPanes(this,pane)
}else {
f = () => this.w.moveFocus("up")
}

break
case "ArrowDown":
f = () => this.w.moveFocus("down")
if(ev.shiftKey){
const pane = this.w.getPane("down")
if(!pane) return;
this.w.swapPanes(this,pane)
}else {
f = () => this.w.moveFocus("down")
}
Comment on lines +605 to +611
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Provide user feedback when no pane exists to swap with on Shift+ArrowDown

When swapping panes downward, inform the user if there's no pane below.

Apply this diff:

if (ev.shiftKey) {
    const pane = this.w.getPane("down");
    if (!pane) {
+       this.gate.notify("No pane below to swap with.");
        return;
    }
    this.w.swapPanes(this, pane);
} else {
    f = () => this.w.moveFocus("down");
}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if(ev.shiftKey){
const pane = this.w.getPane("down")
if(!pane) return;
this.w.swapPanes(this,pane)
}else {
f = () => this.w.moveFocus("down")
}
if(ev.shiftKey){
const pane = this.w.getPane("down")
if(!pane) {
this.gate.notify("No pane below to swap with.");
return;
}
this.w.swapPanes(this,pane)
}else {
f = () => this.w.moveFocus("down")
}

break
case "p":
f = () => this.t7.dumpLog()
Expand Down
6 changes: 6 additions & 0 deletions src/terminal7.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,12 @@ export class Terminal7 {
dV.addEventListener("click", () => {
if (this.activeG)
this.activeG.activeW.activeP.split("topbottom", 0.5)})
const rotateLayout = document.getElementById("rotate-layout")
rotateLayout.addEventListener("click", () => {
if(this.activeG){
this.activeG.activeW.activeP.layout.changeDir()
}
})
document.getElementById('add-gate').addEventListener(
'click', async (ev) => {
setTimeout(() => this.map.shell.runCommand('add', []), 50)
Expand Down
40 changes: 39 additions & 1 deletion src/window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ export class Window {
if (this.rootLayout)
this.rootLayout.fit()
}
moveFocus(where) {
getPane(where){
const a = this.activeP,
b = a.t.buffer.active,
x = a.xoff + b.cursorX * a.sx / a.t.cols,
Expand Down Expand Up @@ -213,11 +213,21 @@ export class Window {
if (match(c))
nextPane = c
})
return nextPane
}

moveFocus(where) {
const nextPane = this.getPane(where)
if (nextPane) {
nextPane.focus()
this.gate.sendState()
}
}

switchPane(where){
console.log(this.activeP)
}
Comment on lines +227 to +229
Copy link

@coderabbitai coderabbitai bot Oct 20, 2024

Choose a reason for hiding this comment

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

⚠️ Potential issue

Implement functionality for switchPane method

The switchPane method currently only logs the active pane to the console. To fulfill its intended purpose, please implement the logic to switch or rotate panes.

Consider implementing the pane-switching logic or, if this is a placeholder, add a TODO comment to indicate future work:

        switchPane(where){
            // TODO: Implement pane-switching logic based on the 'where' parameter
            console.log(this.activeP);
        }

Copy link
Contributor

Choose a reason for hiding this comment

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

Good point

Copy link

Choose a reason for hiding this comment

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

@daonb, happy to help! Here's a possible implementation for the switchPane method that swaps the active pane with the pane in the specified direction:

switchPane(where: string) {
    const paneToSwap = this.getPane(where);
    if (paneToSwap) {
        this.swapPanes(this.activeP, paneToSwap);
        this.gate.sendState();
    } else {
        console.log(`No pane found in the direction: ${where}`);
    }
}

😊🐰

µµ
updateDivideButtons() {
const bV = document.getElementById("divide-v")
const bH = document.getElementById("divide-h")
Expand Down Expand Up @@ -265,5 +275,33 @@ export class Window {
newLayout.refreshDividers()
return newLayout
}
swapPanes(pane1: Pane, pane2: Pane){
const pane1Layout = pane1.layout
const pane2Layout = pane2.layout
const pane1Index = pane1Layout.cells.indexOf(pane1);
const pane2Index = pane2Layout.cells.indexOf(pane2);
pane1Layout.cells[pane1Index] = pane2;
pane2Layout.cells[pane2Index] = pane1;
pane1.layout = pane2Layout;
pane2.layout = pane1Layout;

const pane1Xoff = pane1.xoff
const pane1Yoff = pane1.yoff
const pane1Sx = pane1.sx
const pane1Sy = pane1.sy

pane1.xoff = pane2.xoff
pane1.yoff = pane2.yoff
pane1.sx = pane2.sx
pane1.sy = pane2.sy

pane2.xoff = pane1Xoff
pane2.yoff = pane1Yoff
pane2.sx = pane1Sx
pane2.sy = pane1Sy

Comment on lines +288 to +302
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Refactor property swapping to reduce code duplication

The swapping of xoff, yoff, sx, and sy properties between pane1 and pane2 can be made more concise.

Consider simplifying the code using array destructuring:

             // Swap position and size properties
-            const pane1Xoff = pane1.xoff
-            const pane1Yoff = pane1.yoff
-            const pane1Sx   = pane1.sx
-            const pane1Sy   = pane1.sy
-
-            pane1.xoff = pane2.xoff
-            pane1.yoff = pane2.yoff
-            pane1.sx = pane2.sx
-            pane1.sy = pane2.sy
-
-            pane2.xoff = pane1Xoff
-            pane2.yoff = pane1Yoff
-            pane2.sx = pane1Sx
-            pane2.sy = pane1Sy
+            [pane1.xoff, pane2.xoff] = [pane2.xoff, pane1.xoff];
+            [pane1.yoff, pane2.yoff] = [pane2.yoff, pane1.yoff];
+            [pane1.sx, pane2.sx] = [pane2.sx, pane1.sx];
+            [pane1.sy, pane2.sy] = [pane2.sy, pane1.sy];
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const pane1Xoff = pane1.xoff
const pane1Yoff = pane1.yoff
const pane1Sx = pane1.sx
const pane1Sy = pane1.sy
pane1.xoff = pane2.xoff
pane1.yoff = pane2.yoff
pane1.sx = pane2.sx
pane1.sy = pane2.sy
pane2.xoff = pane1Xoff
pane2.yoff = pane1Yoff
pane2.sx = pane1Sx
pane2.sy = pane1Sy
// Swap position and size properties
[pane1.xoff, pane2.xoff] = [pane2.xoff, pane1.xoff];
[pane1.yoff, pane2.yoff] = [pane2.yoff, pane1.yoff];
[pane1.sx, pane2.sx] = [pane2.sx, pane1.sx];
[pane1.sy, pane2.sy] = [pane2.sy, pane1.sy];

pane1Layout.refreshDividers();
pane2Layout.refreshDividers();
}
Comment on lines +278 to +305
Copy link

@coderabbitai coderabbitai bot Oct 20, 2024

Choose a reason for hiding this comment

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

⚠️ Potential issue

Handle swapping panes within the same layout to prevent errors

The swapPanes method may encounter issues when pane1 and pane2 are within the same layout. Swapping them without checking can lead to incorrect indexing and behavior.

Add a condition to handle cases where panes share the same layout:

         swapPanes(pane1: Pane, pane2: Pane){
             const pane1Layout = pane1.layout
             const pane2Layout = pane2.layout
             const pane1Index = pane1Layout.cells.indexOf(pane1);
             const pane2Index = pane2Layout.cells.indexOf(pane2);
+            if (pane1Layout === pane2Layout) {
+                // Swap panes within the same layout
+                [pane1Layout.cells[pane1Index], pane1Layout.cells[pane2Index]] = [pane2, pane1];
+            } else {
                 pane1Layout.cells[pane1Index] = pane2;
                 pane2Layout.cells[pane2Index] = pane1;
+            }
             pane1.layout = pane2Layout;
             pane2.layout = pane1Layout;
             // Rest of the code remains the same
         }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
swapPanes(pane1: Pane, pane2: Pane){
const pane1Layout = pane1.layout
const pane2Layout = pane2.layout
const pane1Index = pane1Layout.cells.indexOf(pane1);
const pane2Index = pane2Layout.cells.indexOf(pane2);
pane1Layout.cells[pane1Index] = pane2;
pane2Layout.cells[pane2Index] = pane1;
pane1.layout = pane2Layout;
pane2.layout = pane1Layout;
const pane1Xoff = pane1.xoff
const pane1Yoff = pane1.yoff
const pane1Sx = pane1.sx
const pane1Sy = pane1.sy
pane1.xoff = pane2.xoff
pane1.yoff = pane2.yoff
pane1.sx = pane2.sx
pane1.sy = pane2.sy
pane2.xoff = pane1Xoff
pane2.yoff = pane1Yoff
pane2.sx = pane1Sx
pane2.sy = pane1Sy
pane1Layout.refreshDividers();
pane2Layout.refreshDividers();
}
swapPanes(pane1: Pane, pane2: Pane){
const pane1Layout = pane1.layout
const pane2Layout = pane2.layout
const pane1Index = pane1Layout.cells.indexOf(pane1);
const pane2Index = pane2Layout.cells.indexOf(pane2);
if (pane1Layout === pane2Layout) {
// Swap panes within the same layout
[pane1Layout.cells[pane1Index], pane1Layout.cells[pane2Index]] = [pane2, pane1];
} else {
pane1Layout.cells[pane1Index] = pane2;
pane2Layout.cells[pane2Index] = pane1;
}
pane1.layout = pane2Layout;
pane2.layout = pane1Layout;
const pane1Xoff = pane1.xoff
const pane1Yoff = pane1.yoff
const pane1Sx = pane1.sx
const pane1Sy = pane1.sy
pane1.xoff = pane2.xoff
pane1.yoff = pane2.yoff
pane1.sx = pane2.sx
pane1.sy = pane2.sy
pane2.xoff = pane1Xoff
pane2.yoff = pane1Yoff
pane2.sx = pane1Sx
pane2.sy = pane1Sy
pane1Layout.refreshDividers();
pane2Layout.refreshDividers();
}

Copy link
Contributor

Choose a reason for hiding this comment

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

I believe we assume both panes are of the same layout. It does make sense to check it.

Copy link

Choose a reason for hiding this comment

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

@daonb, understood. Noting that the code assumes both panes are within the same layout makes sense. Adding the check will help ensure proper handling.

(^_^)


✏️ Learnings added
Learnt from: daonb
PR: tuzig/terminal7#496
File: src/window.ts:278-305
Timestamp: 2024-10-21T15:24:31.289Z
Learning: In the `swapPanes` method in `src/window.ts`, it is assumed that both panes are within the same layout.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

// used to recieve the touch event from the gate
}