Prevent editor clipping in narrow windows - #18
Conversation
|
Closing so the change can be tested and reviewed locally before any future submission. |
Removing the 360px floor is the right fix — below a 408px window it exceeded the Flickable's viewport and the outer Math.min could no longer bring the column down, so the first and last characters of every line were clipped away — but replacing the proportional margin with a flat 48px changes the layout far outside that range. 48px is exactly the Flickable's own two 24px insets, so the column now grows to the full viewport at every window width below 1020: at the 720px minimum the window itself asks for, the text sits 24px from each edge instead of 120px, and at twice the desktop text size it sits 24px from each edge instead of 240px. Restore the twenty-character margin as a third argument to the same Math.min, alongside the viewport clamp. The column is then identical to before at every width where it already fitted, and shrinks with the window below 408px where it did not. The test drives the window to 394px, the width the clipping was reported at, and asserts the column stays inside the viewport there and still keeps a margin of its own at the declared minimum width. It fails both ways without this: with the 360px floor the column is 360px inside a 346px viewport, and with the flat margin it fills the viewport edge to edge. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
The floor removal is the right diagnosis. Below a 408px window the 360px floor exceeded the Flickable's viewport ( The flat 48px is the part that needs another look. It is exactly those two insets, so wherever it binds the column fills the viewport edge to edge — and the result differs from master at every window width below 1020px, not only below 408px. At the 720px minimum the window itself declares, the column goes from 480px to 672px and the margin from 120px to 24px per side. At twice the desktop text size the margin was 240px per side and becomes 24px, and the two expressions only agree again at 2040px. So "preserves the existing margins ... at normal window sizes" does not hold: the change is invisible only at the default 1280px window, where the 65-character cap already binds and master is capped too. I pushed cb3a5a3, which keeps your clamp and puts the proportional margin back as a third argument to the same It also adds Worth knowing before this lands: it conflicts textually with #5, which rewrites the same |
Summary
Allow the editor to shrink to the space available inside its existing 24 px side margins.
Hyprland can resize Omawrite below its declared minimum window width. Below 408 px, the previous 360 px editor floor exceeded the viewport and clipped text on both sides.
This preserves the existing margins and 65-character maximum width at normal window sizes. It only changes behavior when the window is too narrow for the previous minimum.
Validation
./bin/test— 12 passed./bin/buildgit diff --check