Skip to main content

MAX_LABEL_LEN

Constant MAX_LABEL_LEN 

Source
pub const MAX_LABEL_LEN: usize = 80;
Expand description

The longest label a selection or measure may carry — a ceiling derived from filenames, not a number anyone picked.

A label becomes crop-<index>-<slug>.png, and most filesystems stop at 255 bytes. The slug maps every character to one ASCII byte, but char::to_lowercase can expand one character into three, so the worst case is:

"crop-" (5) + index (5) + "-" (1) + 3 x label + ".png" (4)  <=  255

which puts the label at 80. [limits] label_length defaults to 64 and may be raised to here; past it a filename could outgrow what a filesystem accepts, which is a constraint rather than a preference.

Enforced here as well as at the keyboard, because a session is a file a human can edit: a label that only the overlay checked would sail in through resume and fail at the filesystem on the next save, which is a confusing place to learn about it.