[TxMt] Re: Reformat ^Q does not account comments and other boundaries

Allan Odgaard mailinglist at textmate.org
Fri Nov 22 02:39:25 UTC 2013


On 20 Nov 2013, at 18:19, Adam Strzelecki wrote:

> […] So basically reformat should take into account paragraph 
> boundaries of given language (grammar). I’d say it would be just 
> enough if paragraph boundary would be:
> (1) line with commend
> (2) ending or starting of fold scope

Another example is quoted text (in emails / markdown).

If you use ⌃⌘T with key equivalent search for all scopes you can see 
we overload ⌃Q for a few, though only quoted text in emails is really 
a case where the command is semantically doing the same action (AFAIK).

It does sound like a way to make the built-in code adaptable to handle 
more non-prose cases would be to introduce a prefix character setting 
(possibly regexp).

I’m not sure if it should always be a paragraph separator versus a 
prefix character that gets stripped before doing the reflow, and then 
added after the reflow, with lines that have different prefixes 
considered different paragraphs, and thus would also act as separators, 
since it should only reflow a single paragraph at a time. This should 
allow reflowing comments and quoted text (when caret is on a line with 
such, while pressing ⌃Q).

Btw: The built-in code already has some logic to deal with bulleted list 
items (iirc).


More information about the textmate mailing list