Skip to content

Fix native code and math editing with live calculator results - #96

Merged
tiensonqin merged 1 commit into
mainfrom
fix/code-block-language-layout
Oct 25, 2026
Merged

tiensonqin merged 1 commit into
mainfrom
fix/code-block-language-layout

Conversation

@tiensonqin

@tiensonqin tiensonqin commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Keep the code language selector as a small, untranslated caption inside the code container, so “Plain text” and “calc” no longer appear as separate prose rows. Code, Calculator and Math use Enter to create a plain sibling block and Shift+Enter for a line break.

  • Render Calculator expressions on the left and live per-line results on the right, using the shared OCaml evaluator and the unsaved editor draft, including variables and last.
  • Restore long-press block selection over code and math previews, and preserve ordinary text/math previews when code content or editors mount and unmount.
  • Cover master-compatible slash-command behavior through both clicking and Enter: clear the slash and typed query, preserve surrounding Unicode text, and insert code/calculator after nonempty content.
  • Keep code containers at their content height on Android and share the layout in OCaml.

Validation:

  • Full OCaml core gate: 1183 tests passed. The remote ocaml-core CI check also passed.
  • iOS 26 simulator build and native checks passed: Enter/Shift+Enter, UTF-16 selections and delayed caret acknowledgements, ordinary text/code/math preview mounting, actual formula rendering, and code-to-plain-block keyboard focus. Calculator live results and code/math long-press selection were also exercised in the simulator.
  • Android debug build and emulator checks passed: 19 rich-content interaction tests, 8 code/math rendering tests, and the real-core Calculator integration covering live results, horizontal layout, exactly one new block on IME Enter, and long-press selection.
  • Remote iOS E2E bootstrap stops before compiling the app because its cached opam switch requires ocaml-base-compiler.5.5.2, which is no longer available.

Recordings use the same offline fixture on the iOS 26 simulator. Video files and diagnostic logs are excluded from the commit.

Before — main 59154a47: detached language label, no live result column, and Enter stays in the code block.

before-calculator-main-comparison.mp4

After — 3029ce41: compact language selector inside the container, live results (42 and 126), Shift+Enter newline, Enter creates a sibling, and long-press block selection.

after-calculator-3029ce41.mp4

@tiensonqin
tiensonqin marked this pull request as ready for review October 25, 2026 10:48
@tiensonqin
tiensonqin merged commit 200c2d1 into main Oct 25, 2026
4 of 5 checks passed
@tiensonqin
tiensonqin deleted the fix/code-block-language-layout branch October 25, 2026 11:10
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.

1 participant