Table of Contents

Method Bounded

Namespace
MailFathom.Application.Emails.Summaries
Assembly
MailFathom.Application.dll

Bounded(string?)

Reduces the opening of a message's text to the one line a row draws.

public static string? Bounded(string? text)

Parameters

text string

The message text as storage answered it, or null where nothing has extracted the message yet.

Returns

string

The preview, or null where the text is absent or carries nothing but whitespace.

Remarks

Runs of whitespace collapse to one space, so a message whose opening is a wrapped quotation does not arrive as two hundred characters of line breaks. That makes a preview shorter than the bound rather than longer, which is why the cut belongs to the query and this belongs here: the query is what keeps a body out of this process, and reflowing what it returned cannot put one back. The bound is applied here as well, because a control that holds only while every query asks for the right number of characters is not a control — and it is applied through TruncateAtTextElementBoundary(string, int) rather than by index, because PostgreSQL counts its own cut in codepoints and can therefore answer with more UTF-16 characters than were asked for. A raw slice of that would end inside a surrogate pair, and the lone surrogate left behind is what a JSON writer rejects on the way out of this boundary.