Conversation
The editor width was remembered as an absolute pixel value and reapplied without checking the space available. Once it exceeded the room left after the contents pane, the editor took the whole area and the preview was given zero width, so split view looked exactly like editor only. Every later return to split reapplied the same value, so switching modes could not recover it, and narrowing the window triggered it with no mode switch at all. Add Markdown4DStudio.SplitLayout, a framework free helper holding the two rules: the editor width is clamped so neither pane falls below MinPaneWidth, and below two minimums the space is shared evenly instead. Both studios call it from the four routes that change the split: entering split view, resizing the window, toggling the contents pane and finishing a splitter drag. A resize or a toggle passes the width the editor already has, so a splitter drag is kept and only trimmed when it no longer fits. The splitter's own minimum is restated on every width change, because a splitter asked to honour a minimum the window cannot give lets a drag collapse the other pane. The FMX splitter has no moved event, so its drag is caught on mouse up instead.
The clamp covered four routes but not the contents divider, which is a separate control. Dragging it right grew the contents pane, shrank the area the two halves share and left the preview at 36 pixels, far below the minimum. Narrowing the window while the contents pane was wide did the same. Give the contents pane a bounded width through the new ClampSidePanelWidth, applied wherever the split is laid out. The rule is an order of priority: the contents pane gives way first so the editor and preview keep their minimum, but never below its own minimum of 120, past which the two halves share what is left between them. A contents pane the user already dragged narrow is never widened by the clamp. Both studios hook their contents divider as well, the VCL through OnMoved and FMX through the splitter mouse up.
This was referenced Sep 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Independent of #7 and #8. This branch is cut from
mainand touches different code, so it can merge in any order.The bug
Split view collapses into what looks exactly like editor only. The preview disappears, and switching modes never brings it back. Making the window wider is the only recovery.
The editor width is remembered as an absolute pixel value and reapplied without checking the space available. Once it exceeds the room left after the contents pane and the splitter, the editor takes the whole area and the preview is given zero width. Because every later return to split reapplies the same value, the state is sticky. The resize handler did not touch the split at all, so narrowing the window triggered it with no mode switch involved.
Measured with the x positions of the pane dividers. Two dividers means the preview is present, one means it is gone.
A second report against the first version of this branch found the same symptom through the contents divider: dragging it right left the preview at 36 pixels. That is fixed here too, in the second commit.
The fix
A new framework free unit,
Examples/Shared/Markdown4DStudio.SplitLayout.pas, holds the rules so they are testable without a form and shared by both studios:ClampEditorWidthkeeps the editor between the minimum and whatever leaves the preview its minimum. Below two minimums the space is shared evenly rather than handed to one pane.EffectiveMinPaneWidthgives the minimum a splitter can actually enforce right now. A splitter asked to honour a minimum the window cannot give lets a drag collapse the other pane, which is a real failure on a narrow window.ClampSidePanelWidthbounds the contents pane, so it cannot grow, or stay wide, at the cost of the two halves.The result is an order of priority. The contents pane gives way first so the editor and preview keep their 300 pixels. It never gives way past its own minimum of 120, and below that the two halves share what is left between them. A contents pane the user already dragged narrow is never widened by the clamp.
Both forms apply this from every route that changes the split: entering split view, resizing the window, toggling the contents pane, and finishing a drag on either divider. Entering split view asks for the remembered width; the other routes pass the width the editor already has, so a deliberate drag is kept and only trimmed when it no longer fits.
The FMX splitter has no moved event, so its drags are caught on mouse up.
Testing
Nine DUnitX tests cover the helper, including regression cases built from the measurements above. Each was written first and confirmed failing before the production code existed.
Markdown4DStudioVCL,Markdown4DStudioFMXandMarkdown4D.Testsall build clean on Win32 Debug with Delphi 12 Athens.The FMX side is covered by the shared tests and identical wiring, but was not driven interactively: its Skia canvas does not capture through
PrintWindow, which made scripted visual checks unreliable on my machine.Known limitation
Widths are pixel values, not proportions. Shrinking the window trims the editor and the contents pane, and widening it again does not restore their earlier widths. A proportional split would fix that and is a larger behavioural change, so it is deliberately out of scope here.