Skip to content

Syntax for word-wrapping messages (format=flowed?) #117

@andersk-auto

Description

@andersk-auto

(See also BarnOwl:ticket:82.)

We should officially define some mechanism for automatically word-wrapping text in zephyrs. The basic observation is that while most text is prose can be reflowed, some text is preformatted (code, ASCII art, lists, etc.) and should not be automatically reflowed. It'd be nice to handle the former better without breaking the latter.

The existing standard here is from [http://www.ietf.org/rfc/rfc3676.txt RFC 3676], an extension to email to allow sane rewrapping of text -- primarily quoted text, but it helps unquoted text too. The gist is that the Content-Type is set to text/plain; format=flowed, and wrappable lines have a space at the end, i.e., space-LF is treated as a soft line break that can turn into a space, and signal that the current paragraph is rewrappable.

The format=flowed spec also implies that wrapped paragraphs can be unconditionally displayed in a proportional font, which I think most non-terminal clients (probably including the reference windowgram client) would appreciate being able to do wherever possible.

I suggest that we define some flag in messages for indicating that format=flowed is in effect, so that compliant receivers can follow the rules specified in that RFC for rendering it. I don't think we need to customize those rules, and we can demand that clients be fully conformant to the RFC, including space-stuffing and quote-handling and everything else. (We can probably hard-code DelSp to on; this effectively involves using two spaces at the end of lines.)

On the sending side, some clients, like barnowl, will allow reflowing long lines of text within the editor window (either automatically or with a command). These clients can therefore distinguish lines to be marked as "flowed" (with trailing spaces) and lines to be marked as "fixed". Other clients, like the reference zwrite client, don't have this mode of user interaction for rewrapping. Absent adding a richer UI to zwrite, perhaps the best option is to add a command-line flag, perhaps with a user-settable default, that says that the message is to be rewrapped according to the format=flowed rules.

It is at least somewhat possible that we can get away without a flag, and somehow sniff whether format=flowed interpretation is appropriate. Since the spec flowed paragraphs to consist of at least one flowed line followed by a fixed line, there's no question of what to do with a single long line (it is fixed, and should not be rewrapped). We'd need to define our own ad-hoc variant of format=flowed; I think it would suffice to skip the space-stuffing rules and require DelSp=yes and the spec would hold, and that there would be no issues with misparsing text that isn't intended to be flowed, but I'd have to think harder to be confident.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions