feat(mtext): editable preview with caret, blink, and new-line support

Type directly into the rendered MText preview: click to position the
caret, insert/delete, Enter for a new line, Space for a literal space,
and arrow keys to move. The caret blinks when idle.

Keep the trailing empty paragraph in the editor so the caret appears on a
fresh line immediately after Enter, before any typing. parse_mtext_paragraphs
split into a _ex variant; layout_mtext skips the blank-edge trim when
emitting glyph boxes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Hakan SevenandClaude Opus 4.8 committed 2026-05-31 13:14:35 +03:00
1 parent 9fa33ec7a0
commit ac9022676f
8 files changed
+162 -26

No files matched your search

+5
View File
@@ -550,6 +550,9 @@ pub enum Message {
WindowResized(f32, f32),
/// Enter pressed globally — finalises the active command (no text-input involvement).
CommandFinalize,
/// Space pressed globally — a literal space in the MText preview, otherwise
/// finalises like Enter.
CommandSpace,
/// Escape pressed globally — cancels the active command.
CommandEscape,
/// Toggle the global snap on/off (OSNAP button body click).
@@ -746,6 +749,8 @@ pub enum Message {
MTextSelTo(usize),
/// Move the preview caret by N visible characters.
MTextCaretMove(i32),
/// Timer tick toggling the preview caret's blink phase.
MTextCaretBlink,
/// Commit the editor: create or update the MText entity.
MTextOk,
/// Discard the editor without creating / changing the entity.