[TxMt] "Edit in TextMate" eating spaces and tabs

Allan Odgaard throw-away-1 at macromates.com
Thu Nov 9 03:34:54 UTC 2006


On 9. Nov 2006, at 02:53, Dirk van Oosterbosch, IR labs wrote:

> Well, I experienced something like this on the return trip instead.  
> But also in Mail. When I use tabs at the beginning of a line (in  
> Textmate from ^⌘E), Mail lines them all out to the right (away  
> tabs.)
> But if I ^⌘E back to TM, I see the tabs again. E.g. this line  
> started with a tab.
> Tabs applied in Mail are also gone on their return

Mail is using an editable WebKit for the text editing, which means it  
has normal HTML whitespace collapsing rules, which the Mail team has  
tried to workaround with the use of non-breaking spaces, kHTML  
specific CSS properties, and similar.

Despite their efforts, it is however still prone to breaking.

In the case of leading tabs sent from TextMate, if you, after the  
text has return, add your own space first, it will suddenly respect  
the indent, and you can even remove that space, and it is still being  
respected.

I did consider making a workaround for this, but I already spent  
enough time on this Mail <-> TextMate conversion ;)

As for lacking spaces (as the OP reported), I haven’t seen it, but I  
would imagine it could be because the marked up post (which I convert  
to plain text) has two adjacent elements which would cause a space or  
line break when displayed, but where there technically is not  
whitespace between.

If anyone knows Objective-C, the code for all this is available here:  
http://macromates.com/svn/Bundles/trunk/Tools/Edit%20in%20TextMate/ 
src/WebView:%20Edit%20in%20TextMate.mm






More information about the textmate mailing list