diff --git a/src/renderer/src/App.tsx b/src/renderer/src/App.tsx index 700df3a..244db5f 100644 --- a/src/renderer/src/App.tsx +++ b/src/renderer/src/App.tsx @@ -130,12 +130,22 @@ export function App(): React.ReactElement { toast('Discarded changes', path) } - const [gitW, setGitW] = useState(() => loadNum('helder.gitW', 232)) - const [treeW, setTreeW] = useState(() => loadNum('helder.treeW', 244)) - const [rightW, setRightW] = useState(() => loadNum('helder.rightW', 444)) - useEffect(() => saveNum('helder.gitW', gitW), [gitW]) - useEffect(() => saveNum('helder.treeW', treeW), [treeW]) - useEffect(() => saveNum('helder.rightW', rightW), [rightW]) + // Columns are proportional — Source Control 10%, Explorer 10%, Editor 40% + // (flex:1, takes the remainder), Right column 40% — and re-apply on resize. + // Dragging a splitter still adjusts them until the next window resize. + const [gitW, setGitW] = useState(() => Math.round(window.innerWidth * 0.1)) + const [treeW, setTreeW] = useState(() => Math.round(window.innerWidth * 0.1)) + const [rightW, setRightW] = useState(() => Math.round(window.innerWidth * 0.4)) + useEffect(() => { + function applyProportions(): void { + const w = window.innerWidth + setGitW(Math.round(w * 0.1)) + setTreeW(Math.round(w * 0.1)) + setRightW(Math.round(w * 0.4)) + } + window.addEventListener('resize', applyProportions) + return () => window.removeEventListener('resize', applyProportions) + }, []) // Seed explorer expansion from the tree's `open` flags once per opened project. const seededRoot = useRef(undefined) @@ -373,7 +383,11 @@ export function App(): React.ReactElement { cursor={cursor} selection={selection} setCursor={setCursor} setSelection={setSelection} bufferText={bufferText(active)} onEdit={onEdit} /> - setRightW((w) => clamp(w - dx, 280, 780))} /> + setRightW((w) => { + // grow until the editor would drop below ~280px (rather than a fixed cap) + const max = Math.max(280, window.innerWidth - gitW - treeW - 280) + return clamp(w - dx, 280, max) + })} /> {/* keyed by root so the PTYs respawn in the new cwd when the project switches */} {proj.ready && } diff --git a/src/renderer/src/components.tsx b/src/renderer/src/components.tsx index a7f6f5d..416a16b 100644 --- a/src/renderer/src/components.tsx +++ b/src/renderer/src/components.tsx @@ -114,13 +114,9 @@ export function GitPanel({ branch, changes, staged, committed, commitMsg, setCom