Skip to content

Sum limits under and over as typed; WPF quick bar font; WinUI demo light theme [no-new-version] - #61

Merged
simonebortolin merged 11 commits into
mainfrom
ccr-b9b58be6-g7nugv
Nov 14, 2026
Merged

simonebortolin merged 11 commits into
mainfrom
ccr-b9b58be6-g7nugv

Conversation

@simonebortolin

Copy link
Copy Markdown
Owner

Fixes for findings from testing the editor on Avalonia, WPF and WinUI.

Editing: an n-ary operator built up before its operand takes the limits of its kind

Typing \sum_(i=1)^n i^2 put the limits at the right of the sum (\sum\nolimits_{i=1}^n in the LaTeX output). After Build down then Build up, the same equation had them under and over, as in Word. The bug showed in both Avalonia and WPF.

  • Cause: the space builds up ∑_(i=1)^n before its operand is typed. On its own, UnicodeMath reads it as an operator with scripts (msubsup). With an operand, it reads it as munderover.
  • Fix: BuildUp.Parse reads the run again with an empty operand (▒〖〗) and keeps the limits the parser gives there. A sum or product in display gets munder/mover/munderover. An integral, or ∯, keeps its scripts at the right. LaTeX input already read \sum_{i=1}^n this way.
  • A limit over or under an n-ary operator is reopened as text when the other limit is typed after a space. It now goes back to the text it was typed as (∑^2), not ∑┴2.

WPF: the floating bar in the font of the system

The popup inherited the font size of the editor (28 in the demo), so its buttons were much larger than the rest of the interface. The bar now uses SystemFonts.MessageFontSize and MessageFontFamily.

Uno demo: the white page in the light theme on WinUI

With the dark theme of Windows, WinUI wrote all the text of the demo white on its white page, the equation included, so nothing typed could be seen. The page now requests ElementTheme.Light.

Verified

  • On Linux: Avalonia tests 204/204 pass, including new tests on ∑, ∏, ∫, ∯ and LaTeX. Uno tests under Xvfb: 14/14 pass.
  • LimitsOfAnNaryOperator now expects the limits of \sum under and over.
  • Not verified on Windows yet: the WPF bar and the WinUI demo. The CI runs the WPF and WinForms tests there.

Not in this PR

On Avalonia, the floating bar can cover controls under the editor when the selection is at its bottom. Fixing it changes how the bar behaves (open it above the equation, or close it when the pointer leaves), so it waits for a decision.

The branch also merges the old branch of #60, merged by squash. That merge leaves the content of main unchanged.


Generated by Claude Code

…Sharp [no-new-version]

The controls of WPF for Windows Forms (net10.0-windows, net481), over the view of
Rendering: Skia draws the equation into a bitmap that the window shows (no GDI+
drawing), each glyph a path of its outline; the floating bar is a form that never
takes the focus, drawn with Skia too. Tests and a demo, on Windows only.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SyVioB8cEKzWWZ7KQGzLfe
SharpEquations.Uno targets WinUI 3 of the Windows App SDK as well
(net10.0-windows10.0.19041): the same code, against Microsoft.WinUI. The target
builds on every system, so that the package packed on Linux has it; the
GlobalStaticResources of the XAML generator of Uno are in an API file of the Uno
targets only. The demo runs on WinUI too (Windows only).

SkiaSharp 4.156.0 and HarfBuzzSharp 14.4.0.100 are pinned for the whole
repository, Avalonia included (it brought SkiaSharp 3), and for the native
libraries that Uno.Sdk adds by itself. Windows Forms uses SKPathBuilder.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SyVioB8cEKzWWZ7KQGzLfe
…o-new-version]

Setting Padding in the constructor of MathEditBox laid out the equation through
OnPaddingChanged before View was made, and every editor failed with a
NullReferenceException.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SyVioB8cEKzWWZ7KQGzLfe
… same n-ary operator [no-new-version]

∑^2, a space, then _2 gave the subscript of the whole sum, 〖∑^2〗_2 (the same
for ∫, and for x^2 then _3), which no UnicodeMath reads: the second script began a
run of its own whose base was the built structure. A _ or ^ typed just after a
structure that has only the other script now takes the structure back as linear
text into its run, so that both build up together, as when they are typed in one go.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SyVioB8cEKzWWZ7KQGzLfe
…the editor first [no-new-version]

The picture of the equation was recorded again only when the view asked for a
measure. A parent with a layout of its own (the FlowLayoutPanel of the demo, whose
labels change at each key) measured the editor before its view heard of the edit,
so the view asked only for the caret: the caret moved, and the text typed was not
drawn until it built up. The picture is now recorded again whenever the layout it
was made of is not that of the view.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SyVioB8cEKzWWZ7KQGzLfe
…no-new-version]

The scripts of an msubsup whose base is a token took no account of the height
and the depth of the base, as for a letter (TeX, rule 18a): the lower limit of an
integral in display, which is made larger and centred on the axis, was halfway
down it. A large operator is a box of its own (TeX, rule 13): its scripts drop
from its top and its bottom.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SyVioB8cEKzWWZ7KQGzLfe
…rsion]

On WinUI 3 the app without App.xaml had no XAML metadata provider, which the XAML
compiler writes for one: XamlControlsResources could not resolve its own types
and failed with 'Cannot find a resource with the given key:
AcrylicBackgroundFillColorDefaultBrush'. The App hands WinUI the metadata
provider of the controls on Windows.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SyVioB8cEKzWWZ7KQGzLfe
…ts of its kind [no-new-version]

∑_(i=1)^n typed and built up by a space, before its operand, was read by
UnicodeMath as an operator with scripts: the limits went at its right, and the
LaTeX wrote \sum\nolimits, while the same equation built down and up again had them
under and over it. The run is read again with an empty operand, and the operator
takes the limits it has there: under and over a sum in display, at the right of an
integral. A limit over or under it, reopened when the other limit is typed, goes
back to the text it was typed as (∑^2, not ∑┴2).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SyVioB8cEKzWWZ7KQGzLfe
…he equation [no-new-version]

The popup of the bar inherited the font size of the editor (28 in the demo), and its
buttons were much larger than the rest of the user interface.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SyVioB8cEKzWWZ7KQGzLfe
With the dark theme of Windows, WinUI wrote the text of the demo, the equation
included, white on its white page: nothing typed could be seen.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SyVioB8cEKzWWZ7KQGzLfe
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SyVioB8cEKzWWZ7KQGzLfe

# Conflicts:
#	src/SharpEquations.Editing/MathEditor.cs
#	tests/SharpEquations.Avalonia.Tests/Controls/MathEditBoxTests.cs
#	tests/SharpEquations.Avalonia.Tests/Editing/BuildUpTests.cs
@github-actions

github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

Pre-release removed now that this PR is closed.

@simonebortolin
simonebortolin added this pull request to stack #63 November 14, 2026 22:30
@simonebortolin
simonebortolin merged commit 8bb4731 into main Nov 14, 2026
28 checks passed
@simonebortolin
simonebortolin deleted the ccr-b9b58be6-g7nugv branch November 14, 2026 22:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants