fix: add 3-way horizontal split variant and fix file manager overflow in split view (#796)

Adds a "3-Way (H)" layout option (2 top + 1 bottom) alongside the
existing "3-Way (V)" (1 left + 2 right).

Fixes file manager content overflowing its split pane by adding
min-h-0 to nested flex containers that were missing it.
This commit is contained in:
ZacharyZcR
2026-05-21 02:15:59 +08:00
committed by GitHub
parent 5971bcfe88
commit ecb7f4f2c5
5 changed files with 48 additions and 3 deletions
+1
View File
@@ -272,6 +272,7 @@ export type SplitMode =
| "none" | "none"
| "2-way" | "2-way"
| "3-way" | "3-way"
| "3-way-horizontal"
| "4-way" | "4-way"
| "5-way" | "5-way"
| "6-way"; | "6-way";
+2 -2
View File
@@ -2551,7 +2551,7 @@ function FileManagerContent({ initialHost, onClose }: FileManagerProps) {
return ( return (
<div className="h-full flex flex-col bg-background relative overflow-hidden isolate"> <div className="h-full flex flex-col bg-background relative overflow-hidden isolate">
<div <div
className="h-full w-full flex flex-col" className="h-full w-full flex flex-col min-h-0"
style={{ style={{
visibility: isConnectionLogExpanded ? "hidden" : "visible", visibility: isConnectionLogExpanded ? "hidden" : "visible",
}} }}
@@ -2855,7 +2855,7 @@ function FileManagerContent({ initialHost, onClose }: FileManagerProps) {
: "hidden md:flex", : "hidden md:flex",
)} )}
> >
<div className="flex-1 flex flex-col overflow-hidden border border-border bg-card"> <div className="flex-1 flex flex-col overflow-hidden min-h-0 border border-border bg-card">
<FileManagerSidebar <FileManagerSidebar
currentHost={currentHost} currentHost={currentHost}
currentPath={currentPath} currentPath={currentPath}
+4 -1
View File
@@ -98,7 +98,8 @@ export const FOLDER_COLORS = [
export const SPLIT_MODES: { id: SplitMode; label: string }[] = [ export const SPLIT_MODES: { id: SplitMode; label: string }[] = [
{ id: "none", label: "None" }, { id: "none", label: "None" },
{ id: "2-way", label: "2-Way" }, { id: "2-way", label: "2-Way" },
{ id: "3-way", label: "3-Way" }, { id: "3-way", label: "3-Way (V)" },
{ id: "3-way-horizontal", label: "3-Way (H)" },
{ id: "4-way", label: "4-Way" }, { id: "4-way", label: "4-Way" },
{ id: "5-way", label: "5-Way" }, { id: "5-way", label: "5-Way" },
{ id: "6-way", label: "6-Way" }, { id: "6-way", label: "6-Way" },
@@ -108,6 +109,7 @@ export const PANE_COUNTS: Record<SplitMode, number> = {
none: 0, none: 0,
"2-way": 2, "2-way": 2,
"3-way": 3, "3-way": 3,
"3-way-horizontal": 3,
"4-way": 4, "4-way": 4,
"5-way": 5, "5-way": 5,
"6-way": 6, "6-way": 6,
@@ -117,6 +119,7 @@ export const PANE_LAYOUTS: Record<SplitMode, string> = {
none: "", none: "",
"2-way": "grid-cols-2 grid-rows-1", "2-way": "grid-cols-2 grid-rows-1",
"3-way": "grid-cols-2 grid-rows-2", "3-way": "grid-cols-2 grid-rows-2",
"3-way-horizontal": "grid-cols-2 grid-rows-2",
"4-way": "grid-cols-2 grid-rows-2", "4-way": "grid-cols-2 grid-rows-2",
"5-way": "grid-cols-3 grid-rows-2", "5-way": "grid-cols-3 grid-rows-2",
"6-way": "grid-cols-3 grid-rows-2", "6-way": "grid-cols-3 grid-rows-2",
+32
View File
@@ -19,6 +19,8 @@ function defaultSizes(mode: SplitMode): {
return { rowSizes: [100], rowColSizes: [[50, 50]] }; return { rowSizes: [100], rowColSizes: [[50, 50]] };
case "3-way": case "3-way":
return { rowSizes: [50, 50], rowColSizes: [[50, 50], [100]] }; return { rowSizes: [50, 50], rowColSizes: [[50, 50], [100]] };
case "3-way-horizontal":
return { rowSizes: [50, 50], rowColSizes: [[50, 50], [100]] };
case "4-way": case "4-way":
return { return {
rowSizes: [50, 50], rowSizes: [50, 50],
@@ -444,6 +446,36 @@ export function SplitView({
</div> </div>
)} )}
{splitMode === "3-way-horizontal" && (
<div className="flex flex-col w-full h-full min-h-0">
<div
className="flex min-h-0 overflow-hidden"
style={{ height: `${rowSizes[0]}%` }}
>
<div
className="min-w-0 min-h-0 overflow-hidden"
style={{ width: `${rowColSizes[0][0]}%` }}
>
{pane(0)}
</div>
<ColDivider
onMouseDown={(e) => onColDivider(e, 0, 0)}
onTouchStart={(e) => onColDividerTouch(e, 0, 0)}
/>
<div className="flex-1 min-w-0 min-h-0 overflow-hidden">
{pane(1)}
</div>
</div>
<RowDivider
onMouseDown={(e) => onRowDivider(e, 0)}
onTouchStart={(e) => onRowDividerTouch(e, 0)}
/>
<div className="flex-1 min-h-0 overflow-hidden">
{pane(2)}
</div>
</div>
)}
{splitMode === "4-way" && ( {splitMode === "4-way" && (
<div className="flex flex-col w-full h-full min-h-0"> <div className="flex flex-col w-full h-full min-h-0">
<Row rowIdx={0} paneIndices={[0, 1]} /> <Row rowIdx={0} paneIndices={[0, 1]} />
+9
View File
@@ -24,6 +24,15 @@ const LAYOUT_PREVIEWS: Record<SplitMode, React.ReactNode> = {
</div> </div>
</div> </div>
), ),
"3-way-horizontal": (
<div className="flex flex-col gap-0.5 size-full">
<div className="flex gap-0.5 flex-1">
<div className="flex-1 border-2 border-current" />
<div className="flex-1 border-2 border-current" />
</div>
<div className="flex-1 border-2 border-current" />
</div>
),
"4-way": ( "4-way": (
<div className="grid grid-cols-2 grid-rows-2 gap-0.5 size-full"> <div className="grid grid-cols-2 grid-rows-2 gap-0.5 size-full">
<div className="border-2 border-current" /> <div className="border-2 border-current" />