Skip to content

Panes and more! - #720

Open
TheJoeFin wants to merge 41 commits into
devfrom
v5/e6-picker
Open

TheJoeFin wants to merge 41 commits into
devfrom
v5/e6-picker

Conversation

@TheJoeFin

@TheJoeFin TheJoeFin commented Nov 21, 2026 •

Copy link
Copy Markdown
Owner

Summary

Introduces configurable panes and layouts in the Edit Text Window, with side-by-side recent items, Mermaid diagrams, and Markdown previews. The new pane host is enabled by default while retaining the previous editor layout as a fallback for this release. Also adds Markdown to-do list formatting and remembers bottom bar visibility by document type.

Closes #592.

What's changed

Panes and layouts

  • Adds an AvalonDock-based pane host, a versioned JSON layout model and file-backed store, plus pane factories and per-window layout state. The existing calculations pane is extracted into the pane system while retaining its normal controls, width and visibility behavior.
  • Adds four built-in layouts:
    • Classic: editor and calculations pane.
    • Explorer: searchable recent items alongside the editor, with the calculations pane available. Double-click or press Enter to open an item; Ctrl+Enter or the context menu opens it in a new window. A nonblank window is not overwritten.
    • Mermaid: Code-mode source with a live diagram, zoom, full-screen viewing, copy and export. .mmd and .mermaid files select this layout automatically.
    • Markdown preview: highlighted Markdown source in Code mode alongside a read-only rendered preview. Scroll follows the source approximately, and clicking the preview or pressing Enter navigates back to source. .md files continue to open in the existing Markdown mode by default.
  • Adds Window → Layouts and Window → Panes menus to switch layouts, show or hide panes, save a named layout, reset, delete a saved layout, and set a global default. Switching layouts preserves the editor's contents and state; mode changes avoid leaving Markdown mode or discarding spreadsheet view formatting.
  • Resolves layouts in order: explicit request, history entry, built-in file-type mapping, global default, then Classic. Layouts can also be requested with --layout <id> or text-grab://edit-text?layout=<id>; history stores the layout as an optional ID.
  • Retains the old editor-area implementation behind Settings → Edit Text → Use the new pane layout. Disabling it affects subsequently opened windows. Pane dragging, floating, auto-hide and tab headers remain disabled.

Other editor changes

  • Calculations in Code mode follow the code editor's scrolling; using the mouse wheel over results scrolls the editor.
  • Adds a Markdown formatting toolbar action to create or remove interactive to-do list markers, including conversion of selected list items and undo/redo support.
  • Persists bottom bar visibility separately for blank documents and file extensions, falling back to the existing global preference when no per-type preference is saved.
  • Adds draft 4.17.0 Beta 2 release notes and updates third-party notices for the new dependencies.

Compatibility and known limitations

  • The calculations splitter no longer toggles the pane on double-click; use the toggle, Ctrl+P, or the Panes menu. Its resize bar now occupies 5 px beside the pane. Hidden pane controls no longer remain in the tab order.
  • Calculation results can become misaligned with wrapped lines or collapsed code folds. Mermaid previews in Markdown mode currently fall back to the first Mermaid block rather than reliably following the caret, and panning is mouse-only. Markdown preview scroll synchronization is one-way and approximate.
  • The Panes menu does not expose panes in unselected tab groups. Per-file-type layout customization, layout import/export and the full layout editor are not part of this PR.
  • The draft release notes document a separate downgrade caveat: older versions can discard history entries saved in Code mode. Layout IDs themselves are optional and ignored by older versions.

Testing

  • Adds Core and Windows tests for layout validation, serialization, persistence, resolution, history compatibility, pane selection and Markdown/Mermaid source behavior.
  • Adds WPF tests for pane lifecycles, calculations, layout switching, recent items, Mermaid and Markdown previews, and to-do formatting; adds UI automation coverage and editor-area parity fixtures across editor modes and calculation-pane states.
  • Stabilizes the spreadsheet parity comparison by excluding virtualized rows beyond row 10 and lazily realized header grippers, while continuing to compare the remaining editor-area elements.
  • CI build was pending when this description was written. Manual checks for themes, keyboard-only navigation, touch, screen readers and multi-monitor behavior remain outstanding; see the phase notes for pane-specific limitations.

TheJoeFin and others added 30 commits November 19, 2026 22:58
Characterization tests for evaluation, the typing delay, open and close
(wrapping, column width, history), the aggregates, the spreadsheet
selection preview, and scrolling with the text editor. They reach the pane
only through what survives the extraction: the results box by automation
ID, CalcColumn, the history constructor and AsHistoryItem.

Two internal seams let tests open the pane and evaluate it without writing
settings, and the calc part of Window_Loaded moves unchanged into
InitializeCalcPane so tests can run just that part.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…steps 2-3)

IEditorPane, PaneDescriptor and IEditorPaneFactory in Text_Grab.Editing.Panes,
designed for AvalonDock from E4a: no setup in Loaded or Unloaded, and a
hidden pane stays attached. Panes can add command palette entries.

IEditorSession gains what the calc pane took from the window: the culture,
the selected spreadsheet cells' numbers and a change event, and a viewport
in lines (FirstVisibleLine, ViewportChanged, ScrollByWheel). The viewport
follows the code editor in code mode and the text box otherwise, through a
small ILineViewport interface that TextBoxSurface and CodeSurface implement.
Nothing reads the new members yet.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
CalcPane (Text_Grab.Editing.Panes) is a UserControl and IEditorPane holding
the calc column's results box, aggregate status, buttons and help popup,
moved with every name and automation ID, and the evaluation, aggregates and
scroll following moved from EditTextWindow.Calc.cs. It reads the document,
culture, selected spreadsheet numbers and viewport through IEditorSession
only; CalcPaneFactory is registered for the E4a layout renderer.

The window keeps the column, its width, the splitter and shadow, the open
state with its toggles, wrapping, Show Errors and history, and binds the
pane's font size and Show Errors. The pane is no UI Automation element of
its own, so the tree screen readers and UI tests see is unchanged.

The results now scroll with the code editor in Code mode, line for line,
and the wheel over them scrolls the code editor; before, they followed the
hidden text box. In Text mode, sync by line equals the old pixel sync when
the two fonts match.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Adds a tree dump to the UI test harness: Get-UiTestTree wraps
'winapp ui inspect --json' and keeps only what compares between runs
(control type, name, AutomationId, class name, enabled state, child
order), Select-UiTestTreeSlice takes a run of the window's children,
Format-UiTestTree writes them as lines, and Get-UiTestTabOrder records
the focus stops a key visits.

UiTests/Scripts/Export-EditTextUiaFixtures.ps1 drives an Edit Text
Window through Text, Markdown, Spreadsheet and Code mode with the calc
pane closed and open, in fresh automation profiles, and writes the
editor area's tree and its Tab and Ctrl+Tab order for each. The
fixtures in UiTests/Fixtures/EditTextUia come from this branch's build
(E3 calc). The same script run against a dev build without E3 wrote
identical files, so the calc extraction left the tree unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
EtwLayoutDefinition and its dock tree (SplitNode, DockChild, PaneNode,
TabGroupNode) are records with no WPF or AvalonDock type, written and
read by EtwLayoutSerializer as camelCase JSON with enums by name. The
E4b chrome members (ChromeDefinition, BottomBarActionIds,
StatusItemIds) are optional from this first schema version, so a 4.17
file loads unchanged once E4b exists.

A layout file is user-editable input, so Read never throws: malformed
JSON, an unknown node type, a missing member, nesting past MaxJsonDepth
and a newer major schema version all come back as a reason. Members
this version does not know are kept ([JsonExtensionData]) and survive a
load and save, as do tab groups' unselected tabs.

EtwLayoutValidator decides whether a parsed layout can be shown (an
unknown pane ID, the same pane twice, the editor in a tab group, or an
empty split or tab group cannot) and repairs what it can: a layout with
no editor gets one, and unusable sizes fall back. LayoutIds allows only
IDs that are plain file names, since IDs arrive from --layout and from
text-grab:// links.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
ILayoutStore (Core) lists, loads, saves and deletes layouts. Built-in
layouts are embedded JSON in Text-Grab.Core (Layouts/BuiltIn), read by
BuiltInLayouts, and are read-only: saving over one is refused, and a
built-in ID always means the built-in layout.

FileLayoutStore (Core.Windows) keeps saved layouts as
layouts/<id>.json in the folder FileUtilities' storage uses: the
automation profile's data folder under UI tests, the package's local
folder when packaged, the executable's folder otherwise. The file name
is the ID. Loading never throws for a missing, unreadable or malformed
file, and an ID that is not a plain file name is refused before the
disk is touched.

classic.json is today's window: the editor area, and the calc pane to
its right, 200 px (the XAML column width) and collapsed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The Edit Text Window no longer declares CalcPaneControl. Window_Initialized
asks CalcPaneFactory for the pane and inserts it into the editor area's
second column, between ReadingEditorHost and the splitter, where the XAML
element was; it is registered under the same name, so FindName still finds
it. Its two bindings now name their sources (the text box and the Show
Errors item) instead of using ElementName, so they hold wherever a layout
puts the pane.

This is what lets the pane layout keep "a pane not in the layout is not
constructed": a XAML element is constructed whatever the layout. Every
use of the pane now copes with a window that has none.

The UI Automation tree and Tab order are unchanged: the step-1 capture
script writes files identical to the fixtures. New tests check that a
window attaches exactly one calc pane (CalcPane.AttachedCount) and only
that one evaluates, and a characterization test, passed against the old
code first, pins that a new window opens the pane at the column's XAML
width (200) whatever CalcPaneWidth says.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Adds Dirkster.AvalonDock 5.0.2 (Ms-PL, which brings Dirkster.AvalonDock.Core)
to the app, BUILT-WITH.md and the in-app notices.

LayoutRenderer turns a layout's dock tree into one DockingManager: the editor
area (ReadingEditorHost, the four editors and the bookmark, moved as one unit)
is the only document, and every other pane is an anchorable made through its
factory, only when the layout has it, and attached once. Splits are
LayoutPanels, sizes are DockWidth/DockHeight with the pane's minimum (the calc
pane's is 150, now on PaneDescriptor.MinSize), collapsed panes are hidden, and
a tab group shows only its selected pane. Nothing can float, auto-hide, move,
close or be hidden by the user; Ctrl+Tab's navigator and the system menu are
off. PaneHostResources replaces AvalonDock's chrome: no tab strips, title bars,
buttons, side panels or auto-hide area, nothing focusable but the resize bar,
which keeps the splitter's AutomationId, its 5 px and base background, and its
arrow-key resizing. The window reads sizes and shown state back into its live
layout when a resize ends or a pane is shown or hidden.

It is behind EtwPaneLayout, a string setting that is empty by default ("this
build's default", off for now) so a later default change reaches everyone who
has not chosen; a toggle on the Edit Text settings page writes On or Off. With
it on, every calc toggle hides and shows the calc anchorable and still sets
IsOpen, suppresses wrapping and writes CalcPaneWidth, CalcShowPane and the
history fields as before. Focus is put back after showing a pane, which
AvalonDock would otherwise move into it. The window holds the renderer as
IPaneHost, so with the setting off no AvalonDock type is loaded (AvalonDock
registers itself in the WPF XAML namespace, so its assembly is still mapped).

Step 8: existing state carries over through the same settings and history
fields; a new window opens the calc pane at Classic's 200 px, as the
hand-written window does in practice. Step 7: the UI test
pane-layout-editor-area-matches-the-hand-written-fixtures captures the tree and
focus order with the layout on and compares them with the step-1 fixtures,
accepting only AvalonDock's pane containers and the differences now listed in
E4-Layout-Engine.md.

Tests pin the hand-written grid by default (EditTextWindow.PaneLayoutOverride)
and opt in per test; every calc characterization and calc pane test also runs
with the pane layout on.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
LayoutResolver (Core) chooses a window's layout in D5's order: the
caller's, the history item's, the file type's built-in default, then
Classic. Only the first one given is tried; one that cannot be loaded or
shown gives Classic and a notice saying why. LayoutFileTypeDefaults is the
fixed, read-only extension map and ships empty, so every file still opens
in Classic; .md is deliberately not mapped.

Entry points: --layout <id> (alone it opens an Edit Text Window),
text-grab://edit-text?layout=<id> (also paste-markdown and paste-code; an
ID that cannot be one is dropped, since any page can open the link),
WindowUtilities.OpenNewEditTextWindow and a layoutId on
OpenTextInNewEditTextWindow. HistoryInfo.LayoutId is an optional string,
omitted when null and null for Classic, so older builds and older history
files are unaffected; a window reopened with the pane layout off keeps it.
The store is registered in AppServices.

The window resolves after it is made, since a file's type is known only in
OpenPath, and applies the newest result. The notice is recorded at once as
a layout-notice diagnostics event and shown, not modally, once the window
is on screen.

New UI tests: a layout file dropped in the profile's store opens with
--layout (the calc pane on the editor's left), and an unknown layout opens
Classic and says why. The E4 phase file gains its "After the E4a run" notes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Each Edit Text Window records an etw-ready diagnostics event, under an
automation profile only, at the first idle after it has rendered and
finished loading its file, which is when its editor takes input. It carries
the time since the window was made and the process's memory.
UiTests/Scripts/Measure-EditTextOpen.ps1 opens a short and a large document
with EtwPaneLayout off and on, alternating, and reports medians.

Release builds, 7 runs, median open time off -> on: ARM64 short 788 -> 850
ms (+7.8%), large 2,284 -> 2,346 ms (+2.7%); x64 under ARM64 emulation
short 1,526 -> 1,703 ms (+11.6%), large 3,711 -> 3,925 ms (+5.8%).
Working set +3 to +6 MB. A second window in the same process costs the
same either way. The table is in E4-Layout-Engine.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
PaneLayoutSetting.DefaultIsOn is now true: everyone who has not chosen gets
the editor area rendered from classic.json through AvalonDock. The cost
measured in cf1cbed is within the run's budget (open time +2.7% to +7.8%
on ARM64, +5.8% to +11.6% on x64 under emulation; working set +3 to +6 MB).

The hand-written grid stays for this release: Settings > Edit Text > "Use
the new pane layout" writes Off. Revert this commit alone to go back to
off by default; the setting is a string precisely so that the default can
move without anyone's saved settings pinning it.

Gates after the flip: Tests 1251 / 0 failed / 3 skipped, Tests.Core 1379 /
0, Tests.Core.Windows 353 / 0 / 4 skipped, UI suites 23 pass / 9 skipped.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
E4a is Done (8033cba) in the README and the Release Plan. The phase file
gets the step-9 measurements, the default flip and when the hand-written
grid can go (4.18), and the Release Plan notes what Dirkster.AvalonDock
brings with it for the MSIX package check.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A window renders Classic first and switches when its layout resolves, so a
window that ends in a layout without the calc pane still makes Classic's
calc pane and then detaches it. The notes said otherwise; they now say so
and point the fix at E5, whose file-type defaults are the first to reach it.
Arrow-key resizing of the resize bar was checked by hand (10 px a key).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
MIT. Added to BUILT-WITH.md and the in-app notices list.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Recent on the left, the editor, and the calc pane collapsed on the right so
Ctrl+P still works. Classic is unchanged.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
A searchable list of recent Edit Text Window items, grabs and files, from the
tray flyout's provider. Double-click or Enter opens an item: in this window if
it is blank (no text, no file open), otherwise in a new one; Ctrl+Enter and the
context menu always use a new one. The pane is only in the Explorer layout, so
Classic windows never make it or read history. View model on
CommunityToolkit.Mvvm; the history source is injectable and tests replace it
for the whole assembly. Pane actions are registered as descriptors.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Seed history in an isolated profile, open --layout explorer, see the items,
open one with Enter and by double-click, search, and check Classic has no pane.
Not yet run: the run was stopped by low system memory.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The helper wrote a nested JSON array, so the app read empty history. Tests now
bring the window forward and select rows by name, since a row's AutomationId
does not reach UI Automation. Adds a unit test for typing in the search box.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…elector (E5 mermaid)

The mermaid built-in layout (editor | mermaid pane, DefaultMode Code), PaneIds.Mermaid, the
pure rule for how a layout's DefaultMode and DefaultCodeLanguage meet a file's own mode, and
the pure selector that picks the text the pane draws. The file-type map stays empty until
the pane and the window changes land.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
MermaidPane with a CommunityToolkit view model: debounced (300 ms), cancellable rendering through
MermaidImageRenderer, the last good diagram kept under an error strip, idle while hidden,
released on Detach. Export SVG and PNG, copy image, full screen and zoom reuse MermaidDiagram
(Save, CreateContextMenu, OpenViewer) through a new constructor that takes a finished render.
Action descriptors, the factory and CalcPane.CreatedCount are added; no layout maps to it yet.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The built-in file-type map gains .mmd and .mermaid. A window now learns its layout before
InitializeComponent (a LayoutRequest constructor, used by every entry point that opens a file or
a layout in a new window), so a built-in layout is the first one rendered and Classic's calc pane
is never made for a window that ends in the Mermaid layout. A layout's DefaultMode replaces the
mode a Text or Markdown file would open in, and sets the mode of a blank window; a history item's
mode and language win. OpenPath now awaits the file-type layout before choosing the mode.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Six UI tests (.mmd opens the Mermaid layout in Code mode, editing updates the diagram and a broken
source keeps it under an error, --layout mermaid, .txt and .md stay in Classic, Classic has no pane),
fixtures under UiTests/Fixtures/Mermaid, and the E4 and E5 notes, README and Release-Plan rows.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Mode on switch (LayoutDefaults.ModeOnSwitch, CodeLanguageOnSwitch), the store's
global default in layouts/.store.json with synchronous Load and ReadDefaults,
the global default as the last step of layout resolution, EtwLayoutDefinition.BasedOn,
and LayoutPaneEditor for adding and removing panes.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Layouts and Panes submenus in the Window menu (collapsed with the pane layout off),
switching with the mode-on-switch rule, Panes toggles through the live layout with
calc on the existing toggle path, Save as, Reset to built-in, Delete and Set as
default, the layout actions in the registry, store layouts and the saved default
rendered first, and a layout store seam for tests.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Four EditText UI tests (Layouts menu and Explorer, Panes toggles agreeing with the
calc button, Save as then --layout, an untouched window is Classic), the Panes items
made once so they open and reach UI Automation, and the After the picker run notes
in the v5 plan docs.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
TheJoeFin and others added 5 commits November 20, 2026 10:06
The data grid virtualizes rows and realizes header resize grippers lazily, so
the row at the viewport edge (or a column header's gripper) was only sometimes
complete. The comparison now skips spreadsheet rows past row 10 and the
PART_*HeaderGripper thumbs on both sides; everything else is still compared.
No fixtures changed. The flake note in the E6 doc is updated.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@TheJoeFin TheJoeFin added enhancement New feature or request Edit Text Window Anything to do with the Edit Text Window or functions within it labels Nov 21, 2026
@TheJoeFin TheJoeFin changed the title Panes! Panes and more! Nov 21, 2026
TheJoeFin and others added 6 commits November 20, 2026 23:49
Preserve split sizes, guard asynchronous layout changes, and synchronize preview visibility and scrolling. Fix Mermaid preview context menus and window ownership.

Co-authored-by: Copilot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Edit Text Window Anything to do with the Edit Text Window or functions within it enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant