Skip to content

#580 (part 3): the signature bar is the composer's Basic Text group - #860

Draft
ragelfundionctrumnar wants to merge 3 commits into
UCSLabs:mainfrom
ragelfundionctrumnar:fix-580-part-3
Draft

ragelfundionctrumnar wants to merge 3 commits into
UCSLabs:mainfrom
ragelfundionctrumnar:fix-580-part-3

Conversation

@ragelfundionctrumnar

Copy link
Copy Markdown
Contributor

Builds on #859

Part 3 of 4 for #580. UI only: no model or command changes, because the editing commands already act on the open signature. Kept as a draft until part 2 is merged.

What changes for the person using MailCraft

  • File › Signatures formats a signature with the Message tab's Basic Text buttons. Under the Font, Size, Colour, Link and picture controls it already had, a row of Bold, Italic, Underline, Bullets, Numbering, Align Left, Center, Align Right, Decrease and Increase Indent and Clear All Formatting, drawn as the ribbon draws them. They come from the one list the ribbon's group is made from, so the two can't drift apart.
  • Each shows what the signature's selection is (bold, a list, which way it is aligned), and its tooltip names it with its key where it has one.
  • After a click the keyboard is back in the signature, so typing goes on there. Before, the bar's own B, I and U left it nowhere.
  • The bar's old text B, I and U buttons give way to the group's icon buttons. The group's menus are the first row's: Font, Size and Colour were already there, and Highlight joins them (the group has had Text Highlight Color since this was planned), so every control of the group is on the bar; a highlight in a signature is saved and sent like one in a message. Link stays in the first row, as it isn't part of Basic Text.

What it deliberately leaves out: a name for a screen reader on the new buttons. The ribbon's small buttons have none on purpose (tests that find menu items by name count on it), so these are the same; ui-parity.md says so.

Reading order

  1. crates/ui-egui/src/ribbon.rs: pub(crate) fn basic_text(look: &Look) -> Vec<Item>, the Message tab's whole Basic Text group (15 items), moved out of message(), which now builds its group from it unchanged (after the Clipboard group's Format Painter, as before). Item::tip_text is pub(crate).
  2. crates/ui-egui/src/signatures.rs: basic_text(app, ui, look) draws a second row from that list, every item that runs a command, each with widgets::small_frame (its checked state from the look), its tooltip through command_tooltip with the item's key, and its rect as app.hit.add("signatureBar", hit_id(item.key), rect). The old B/I/U loop and command_label are gone. The first row gains a Highlight menu (ribbon::highlight_menu). The layout combo and the picture row are as they were.
  3. crates/ui-egui/src/lib.rs and compose/editor.rs: after an editing command the keyboard goes back to the text it acted on. want_body_focus asks for the open signature while there is one (signature_focus_wanted, apart from a message's body_focus_wanted, which names its compose id since A new mail and a contact open in a window of their own #286), else for the message; HTML and Plain Text, which change the message alone, always ask for the message. Each editor takes only its own, and only when it can take the keyboard; a signature closed or opened again takes its request with it.
  4. Tests: crates/ui-egui/src/signatures_tests.rs (new, registered in lib.rs), with its own signature_page in a window tall enough for the preview to be drawn; one in crates/engine/src/cmd/signature_tests.rs.
  5. Docs: control-protocol.md (a "File › Signatures" row with the hit kinds signature, signatureBody, which was already there and undocumented, and signatureBar), ui-parity.md (the Backstage row and the screen-reader bullet), gaps.md, README.md, ROADMAP.md (rows as docs/log.d/*/580-3.md), the third line of packaging/release-notes.d/new/580.md, and "Highlight" in the six catalogue files.

How it was checked

  • New tests in signatures_tests.rs, each seen failing first:

    • the_signature_bar_offers_every_basic_text_control_of_the_message_tab: every button of the ribbon's group that runs a command is on the bar.
    • bullets_from_the_signature_bar_make_the_open_signature_a_list_item
    • the_signature_bar_shows_what_the_selection_is
    • clear_formatting_on_the_signature_bar_leaves_plain_left_text
    • centre_from_the_signature_bar_is_shown_in_the_preview_as_sent
    • typing_goes_on_in_the_signature_after_a_bar_button
    • the_messages_format_gives_the_keyboard_to_the_message_not_the_open_signature
    • a_signature_closed_before_it_took_the_keyboard_back_leaves_nothing_for_the_next
    • in crates/ui-egui/src/compose_window_tests.rs: a_windows_format_switched_while_a_signature_is_open_gives_the_keyboard_back_to_its_message
    • in crates/engine/src/cmd/signature_tests.rs: a_highlight_in_the_open_signature_is_saved_and_goes_out
  • The ribbon's existing tests pass unchanged, so the Message tab's group is as it was.

  • cargo xtask ci passes on this branch (on parts 1 and 2, on main at 049c16b), all 12 steps.

  • Looked at in light and dark with ui_shot before the rebase: a centred signature line, the new row, the Center button on, and the centred line in the preview.

  • Reviewed by a second model (Codex) over one round, until it found nothing more; after the rebase onto today's main it found that HTML and Plain Text, run while a signature is open, would have sent the keyboard to the signature, that a request could outlive its signature, and that a message behind an open signature lost its request; fixed and tested.

  • Hand-tested on Linux (GNOME, Wayland) with --sample: File › Signatures with a rich signature open, the new row of buttons, the Highlight menu, Center shown in the preview, typing straight after a click; a popped-out message switched to Plain Text while Signatures was open kept the keyboard where it was. Not tried by hand: the window at 1024 px wide, and other display scales.

  • cargo xtask ci passes

  • "Allow edits by maintainers" is ticked

  • I have signed the CLA

Human-reviewed, AI-assisted, nobody's mailbox harmed.

@coderabbitai

coderabbitai Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@ragelfundionctrumnar
ragelfundionctrumnar force-pushed the fix-580-part-3 branch 2 times, most recently from f1eb69a to 49138f7 Compare November 8, 2026 16:37
@sonarqubecloud

sonarqubecloud Bot commented Nov 8, 2026

Copy link
Copy Markdown

@ragelfundionctrumnar
ragelfundionctrumnar force-pushed the fix-580-part-3 branch 5 times, most recently from 348e01a to a0c8125 Compare November 14, 2026 18:10
…format.align

A paragraph of a message or a signature can be aligned left, centred or
right. For now that is the command format.align {"value": "left" |
"center" | "right", from?, to?}, for scripts, the command line and
agents; the ribbon's buttons and the keys come in part 2. It goes out as
text-align on the paragraph's <div>, inline, as Outlook writes it, and
comes back on a paste and when a draft reopens. A picture is aligned
with its line, the one above a signature's text included. A list item
is always left, so a nested list never inherits a centring and every
mail program shows the same thing; a blank line's alignment is not kept
by HTML. Clear All Formatting puts a paragraph back to left.

Also done on the way:
- Alignment is stored only when it isn't left, and read leniently: a
  mailbox written before reads and writes as it did, and a value a later
  version writes reads as left instead of costing a signature its text
  and its pictures.
- The details hash takes alignment in only when it isn't left, so a
  signature made from its details by 0.8.2 still reads as made from
  them (pinned with hashes taken on main).
- Paragraph::with_runs takes the place of the three rebuilds that kept a
  paragraph's kind and level and would have dropped its alignment:
  removing a signature's picture, tidying a signature, and the text
  beside a signature's lead picture. That last one now takes out only
  the lead picture's first place, so a logo standing twice is sent twice.
- The HTML reader keeps a block's alignment (text-align, align=,
  <center>; justify and start read as left, end as right), and marks
  every block inside a list item as part of it (Block::in_item): a
  paste reads a further paragraph, a heading, preformatted text and a
  table's cells inside an item as left, like the item.
- Bullets, Numbering, Increase and Decrease Indent and Clear All
  Formatting take the paragraphs a selection takes as alignment does: a
  line selected with its break no longer makes the line after it a list
  item, which would have cost it its alignment, nor moves it a level or
  out of its list. Whether a selection is all centred (or left, or
  right) passes its list items by, as aligning it does.
- format.align stays out of the Commands list, which runs a command
  with no params.
- Parity checklist (246 of 330), ui-parity, gaps, docs/log.d rows, release notes
  (the feature, and the fix to Bullets, Numbering and Clear All Formatting);
  "Align Text" in the catalogues.

Human-reviewed, AI-assisted, nobody's mailbox harmed.
Align Left, Center and Align Right are in the Message tab's Basic Text
group, in a column of their own after Bullets and Numbering (in the
classic ribbon too, whose columns of three it leaves as they were). Each
shows whether the selection goes its way, and one that is on puts the
paragraph back to left, as Outlook's do; each tooltip says its own key,
but in the browser, where the keys stay the browser's, the three name
none. While the body of a message or File › Signatures' editor has the
keyboard, Ctrl+L, Ctrl+E and Ctrl+R align the paragraph left, centred or
right: there Ctrl+R no longer replies and Ctrl+E no longer goes to the
search, and everywhere else they do as before. The editor draws a
centred or right line where it will be sent, each wrapped row on its own
and a picture alone on its line included, and the caret, a click, the
selection and a picture's frame follow it. A plain-text message is drawn
left, as it goes, and the buttons show no alignment there. In the
browser the three keys stay the browser's; the buttons are the way.

Also done on the way:
- A paragraph is laid out left and each row moved after, to the pixel,
  rather than laid out with epaint's own alignment, which lines a row up
  by its first glyph that isn't a space and would have put a picture
  alone on a centred line its own width left of the middle. One
  function, with what it counts on in epaint 0.37.0 said beside it.
- A wrapped row is centred without the space it was broken at, and
  the spaces it wraps after stand at the body's edge, where the caret
  goes through them, as in a word processor, their underline ends and
  a selection of them shows as a sliver; no row is moved past the
  edge to round it to a pixel.
- A picture made as wide as the body leaves room for the character it
  stands as in the text: in a font that draws that character, epaint
  put the picture's room on an empty row and the picture left of the
  body, whichever way its line went.
- A signature's picture being resized grows from its middle on a
  centred line and from its right on a right one; the sliver that shows
  a selected line break stays inside the body on a right line.
- The ribbon's tooltips and the simplified row's menu look a key up by
  the control's name before its command's, so three buttons on one
  command say three keys.
- Three icons drawn in code: lines of text, long and short by turns,
  standing at the left, the middle or the right.
- ui-parity, gaps, roadmap, README, release note; "Align Left",
  "Center" and "Align Right" in the catalogues.

Human-reviewed, AI-assisted, nobody's mailbox harmed.
…group

File › Signatures formats a signature with the Message tab's Basic Text
buttons. Under Font, Size, Colour, Highlight, Link and the picture
controls, a row of Bold, Italic, Underline, Bullets, Numbering, Align
Left, Center, Align Right, Decrease and Increase Indent and Clear All
Formatting, drawn as the ribbon draws them, from the one list the
ribbon's group is made from, so the two can't drift apart. Each shows what the signature's
selection is, its tooltip names it with its own key where it has one,
and after a click the keyboard is back in the signature, so typing goes
on there. No command changed: the editing commands already act on the
open signature.

Also done on the way:
- ribbon::basic_text(look) is the group's list; the Message tab builds
  its group from it, unchanged.
- The bar's own B, I and U buttons give way to the group's, and the
  three tooltips they had with them.
- Highlight joins Font, Size and Colour in the bar's first row, as the
  Message tab's Text Highlight Color, so every control of the group is
  on the bar; a highlight in a signature is saved and sent like one in
  a message.
- After an editing command the keyboard goes back to the text it acted
  on: the open signature's while there is one (the bar's B, I and U
  used to leave it nowhere), asked for apart from a message's, which
  is asked for by its id (UCSLabs#286); HTML and Plain Text, which change the
  message alone, give it back to the message. A request waits for an
  editor that can take it, and a signature closed, or opened again,
  takes its request with it.
- The control protocol lists File › Signatures' kinds: signature,
  signatureBody (there since signatures were edited in the composer's
  editor) and signatureBar.
- ui-parity (the bar, and that its buttons have no name for a screen
  reader, as the ribbon's small ones), gaps, roadmap, README, release
  note, docs/log.d rows.

Human-reviewed, AI-assisted, nobody's mailbox harmed.
@sonarqubecloud

Copy link
Copy Markdown

This branch has not been deployed

No deployments
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