[TxMt] Re: TM2 feature request: show file encoding and line ending in status bar

Allan Odgaard mailinglist at textmate.org
Mon Aug 27 12:10:31 UTC 2012


On Aug 26, 2012, at 7:57 PM, Adam Strzelecki <ono at java.pl> wrote:

>>>> Not everyone (you work with) uses UTF8, sometimes people you work with save files in the wrong encoding and you have trouble down the line with your project because of that. 
> 
> Why not just create .tm_properties variable i.e. $TM_ENCODING that can be assigned to windowTitle, similar to $TM_SCM_BRANCH?

That might work as a poor man’s solution. I’m still not really sure I follow the reasoning behind the request though, let me explain…

When you open a file in TextMate it does the following:

 1. Does the file have a byte order mark (UTF-8, UTF-16, or UTF-32)?
    → file is UTF-nn

 2. Does file have the com.apple.TextEncoding extended attribute set?
    → read encoding from this attribute and try use that

 3. Is the file valid UTF-8?
    → file is UTF-8 (with 99.9999999% certainty)

 4. Does we have an ‘encoding’ setting for the current file (via .tm_properties)?
    → try use that encoding setting

 5. Ask user what the encoding is.

The request is to show the outcome from the above in the title bar. Why?

There should be little reason to second guess 1-3. Item 4 is 100% under the user’s control, require explicit action to setup, and he can inspect it. Item 5 will visually open a list of encodings and ask the user to check one.

Additionally, if you hit ⇧⌘S then up comes a panel with line endings, encoding, and byte order mark controls. The default values of these controls are based on what was obtained during load.



More information about the textmate mailing list