On Oct 7, 2014, at 10:32 AM, Allan Odgaard mailinglist@textmate.org wrote:
On 7 Oct 2014, at 17:07, Matt Neuburg wrote:
On Oct 7, 2014, at 5:30 AM, Allan Odgaard mailinglist@textmate.org wrote:
Select All (⌘A), delete (⌫), and undo (⌘Z). That should “reset” metadata attached to the text buffer (such as folded ranges).
That's good, but wouldn't it be better to find out what's going wrong with code folding? I've never seen any of these munging issues myself. m.
If the file is changed by another application then the folded ranges (stored as an extended file attribute) will no longer point to the correct ranges. As long as the file is only changed by TextMate, or any changes made outside TextMate also cause the com.macromates.folded extended attribute to be dropped, then there shouldn’t be any issues.
That explains why I see that occasionally, I tend to use git from the command line and switch branches frequently.
IIRC TextMate does see if a file changed and reloads it, couldn't it figure out that folds no longer match? Maybe the stored fold data could be somehow fingerprinted with some file data? Or before re-applying the folding TextMate could check if the stored fold locations match actual fold candidates in the current text?
Gerd