Repository navigation
Drag the lines between panes, and pick their widths with W - #114
rustytensor wants to merge 1 commit into
Conversation
The sidebar, the details, the columns and a split's two halves can be sized by dragging the line beside them. A dragged width is kept between launches until that line is double-clicked or W is pressed. W and Shift+W step through three ways of sizing the panes otherwise: fixed, the widths Folio has always had and still the default; automatic, where the sidebar and the columns fit their widest row; and proportional, where each pane keeps its share of a 1280 px window. A notice names the way picked. The sums live in PaneWidths, apart from the window, so they can be checked without one. Windows can now be given the folder Main.qml is read from, so the tests can open the real window from the source folder.
[Medium impact] The changes affect pane sizing in Folio's main file window. Reserve space for the files before merging; allowed dragged widths can otherwise consume the whole window. FindingsSummaryAdds draggable pane dividers and three width modes, with saved settings and new tests.
Reviews (1) · Last reviewed commit: "Drag the lines between panes, and pick t..." · Reviewed by Greptile |
| visible: win.previewVisible && win.detailsFit | ||
| Layout.topMargin: parent.parent.barHeight | ||
| Layout.preferredWidth: 300 | ||
| Layout.preferredWidth: paneSizing.details |
There was a problem hiding this comment.
At a 1000 px window width, dragging the sidebar to 400 px and the details to 600 px leaves no room for the files. Both widths are allowed, but detailsFit still shows the details because it checks only the window width. leftPane has no minimum width to protect it. These widths are saved, so reopening the window can preserve the unusable layout.
Reserve room for the files when applying widths, or hide the details when the requested panes no longer fit.
| PaneDivider { | ||
| id: grip | ||
| objectName: "columnDivider" | ||
| anchors.horizontalCenter: parent.horizontalCenter | ||
| height: parent.height | ||
| pane: "column" | ||
| } |
There was a problem hiding this comment.
Dragging a column divider changes columnWidth, which changes row.width and fires onContentWidthChanged. That calls revealEnd() on every drag step. If the user has scrolled back to an earlier column, the first resize jumps the view to the last column and moves the grabbed line away from the pointer.
Keep the scroll position or the grabbed line in place while resizing; reveal the end only when navigation adds columns.
The lines between the sidebar, the files, the details and a split's two halves can now be dragged, and W picks how wide the panes are when they haven't been dragged. Until you drag a line or press W, every pane is exactly as wide as it is today.
Why
Folio's panes have fixed widths: 190 px for the sidebar, 260 for each column, 300 for the details. On a laptop that's a lot of the window for the sidebar and the details. On a wide screen, the columns cut off long names while there's room to spare. And a split is always half and half, even when one side needs more room than the other.
Dragging a line fixes the pane you're looking at. W is for when you want all of them to follow a rule instead of sizing each one by hand.
What you'd notice
Keys
W and the double-click are in the README and the
?overlay. The new strings are only inen.json.What changed
PaneWidthsclass does the sums: the way picked, the window's width, the dragged widths and each pane's limits. It's kept apart from the window so it can be tested without one. Each window has its own, andMain.qmlkeeps the way and the dragged widths in its Settings.PaneDivider.qmlis the grip on each line. It has no look of its own. A press only counts as a drag once the pointer moves across by the system's drag distance, so a click or a press that wobbles up and down leaves the pane alone.Main.qmlputs a grip on the sidebar's line, the split's line and the details' edge, and gives the sidebar, the details and a dragged split their widths fromPaneWidths.FolderColumnsputs a grip on the line after each column, and in automatic mode measures the widest name across the columns on screen. It measures with the font and margins of the rows it really draws, whichFileRownow exposes, so the measured width matches what's drawn.Sidebarsays how wide its widest row is.FolderPaneadds W and Shift+W.Windowstakes the folder Main.qml is read from (the app's resources by default), so a test can open Folio's own window from the source folder.Tested
On Fedora 45 in a clean build root, built with the project's
-Wall -Wextra: no warnings, on a clean rebuild.folio_tests: 195 passed, 12 skipped, 2 failed. Main passes 182 on the same root, and the 13 new tests below all pass. The two failures are the same ones main has there (kindsFromMimeTypes,previewerPicksAViewerForEachType, Fedora's MIME type for shell scripts).paneWidthsStartFixed: with nothing picked, the widths are today's 190, 300 and 260, and a split is even.paneWidthsFollowTheWindow: the proportional widths at 2560, 960 and 640 px, including where the limits stop them.paneWidthsFitTheirContent: the automatic column width for short, medium and 300-character names, and the sidebar fitted to a pinned folder with a very long label.paneWidthsKeepWhatYouDrag,paneWidthsDragInAnyMode: real drags on each line in a window that usesMain.qml's own Settings. Each test checks the width reached, the limits, that a double-click puts the pane back, that a dragged width stays while the window is resized and the others follow it, and that a new window finds the same widths.paneWidthsKeyStepsThroughModes: W and Shift+W go round in both directions, the banner says which way is on, and a dragged width is let go.splitWindowSharesItsRoom,splitDividerMovesFromWhereTheHalvesAre: in Folio's real window, the halves, the sidebar, the details and the lines add up to the window's width exactly. A half held at its 360 px minimum moves as soon as you drag it, without a dead zone first.dividersTurnRoundRightToLeft: right to left, each line drags its pane the right way, and a column's line can be grabbed on either side.automaticColumnsFitTheRowsTheyDraw: a long name fits its column with nothing cut off, measured from the row on screen.automaticColumnsOpenALargeFolderWithoutFreezing: fitting the columns while 20,000 names load never holds the window up for 250 ms or more.dividerPressWithoutADragKeepsTheWay: a press that doesn't move across leaves the pane following its way.scrollBarsKeepTheirPresses: in the list and the columns, left to right and right to left, dragging a scroll bar next to a line scrolls the files and resizes nothing.I also broke the right-to-left handling in
PaneDivider.qmlon purpose and ran the same check, anddividersTurnRoundRightToLeftfailed as it should.This doesn't depend on the tree view PR, and either can go in first. They edit neighbouring lines in the same files, and both add the same test helper for opening Folio's real window, so whichever lands second will need a rebase. I'll do that rebase.