Text => Filter through command... perl -pe 's#~\n#\n#'
Dear Paul, Thank you for having explained me how to solve this stupid-but-big problem with search/replace in TextMate! The workaround you suggest works fine and faster than TextWrangler. And, believe it or not, I would not have found it alone: my command-line skills are beyond mediocrity. However, I suspected I missed something... :-) I hope your kind answer will help some other newbies too. Thanks again! A.
Allan, (& the listers)
since this is something very useful, would it not be worth a) addition to the menu or b) at least a bundle as well as some "marketing"?
I believe there are many such really simple things where standard command line tools or one-liners would help but which are not as obvious to many people?
marketing: - daily hints - menu item - some prominent part of the help file - a prominent bundle name PLUS some form of documentation that cannot be overlooked? - maybe some form of hint on the search/replace window that there are alternatives? I remember a checkbox in TextWrangler/BBedit where you could use grep (just by adding this I looked up the docu which I might not have done otherwise!)
Dan
On 27/5/2006, at 16:03, Aristide Grange wrote:
Thank you for having explained me how to solve this stupid-but-big problem with search/replace in TextMate! [...]
Just FYI the problem comes not from stupid code but from data structure trade-offs.
TextWrangler, which you mention, use (AFAIK) a continuous buffer for the text with a gap/hole where the caret is. This allows for constant time movement and insertion, and linear time search’n’replace -- generally a very good data structure for a text editor, except it does not (easily) allow for many of the things I do in TextMate, for example folding of code blocks.
I instead use a data structure which does most normal editing operations just fine, and allows for easy attaching meta data to text, preserving meta data after editing operations, etc. -- something which has proven very valuable through the last year, used e.g. for smart typing, real time snippet transformations, etc. But it has trade-offs, like doing a global replacement involving \n.
So this is not about fixing broken code, it is about coming up with data structures that gives you the best of everything.