Hi,
I have a tiny suggestion.
For me it is often the case that I have to replace, let's say hex \x0B (TAB INDENTION), with '\n'. If I do it using TM's Find/Replace dialog it takes several minutes for a file with 400 lines and, let's say 4000 occurrences of '\x0B'. Furthermore TM occupies a lot of my CPUs.
If I do the same by using the 'Filter-Command' with e.g. 'perl -npe s/ \x0B/\n/g' it only takes a few seconds.
I could image that the speed problem arises if the Find/Replace routine has to insert '\n'.
Would it make sense to include an option or button within the Find/ Replace dialog, like 'External Replace All' or whatever, to call an external maybe perl/sed/ruby routine to do the job, esp. if I want to insert many NEW LINES?
I don't know what kind of disadvantages it would have.
Of course, one could write a tmCommand with a dialog to do it (or using the Filter command), but in order to avoid additional typing I would suggest to include such a functionality within TM's Find/ Replace dialog. Esp. for users who don't know the syntax to write such a regular expression would it be helpful, I think.
Cheers,
Hans
On Mar 23, 2007, at 4:52 AM, Hans-Joerg Bibiko wrote:
Hi,
I have a tiny suggestion.
For me it is often the case that I have to replace, let's say hex \x0B (TAB INDENTION), with '\n'. If I do it using TM's Find/Replace dialog it takes several minutes for a file with 400 lines and, let's say 4000 occurrences of '\x0B'. Furthermore TM occupies a lot of my CPUs.
If I do the same by using the 'Filter-Command' with e.g. 'perl -npe s/\x0B/\n/g' it only takes a few seconds.
I could image that the speed problem arises if the Find/Replace routine has to insert '\n'.
Yes the problem has to do with the new lines created being processed by the parser immediately. Unless I am mistaken though, this will be fixed in 2.0, so if that's the case then I wouldn't expect any changes before 2.0.
Hans
Haris Skiadas Department of Mathematics and Computer Science Hanover College
Could you not also search for a tab character (copy and paste it in there), and the replace with a new line char (again, C&P). wouldn't need to do the more complex regexy stuff, and would hopefully be faster.
P,S: List virgin! yay for it being to help rather than consume.
Cheers, Al. ☠☢✯☢☠
On 23/03/2007, at 11:23 PM, Charilaos Skiadas wrote:
On Mar 23, 2007, at 4:52 AM, Hans-Joerg Bibiko wrote:
Hi,
I have a tiny suggestion.
For me it is often the case that I have to replace, let's say hex \x0B (TAB INDENTION), with '\n'. If I do it using TM's Find/ Replace dialog it takes several minutes for a file with 400 lines and, let's say 4000 occurrences of '\x0B'. Furthermore TM occupies a lot of my CPUs.
If I do the same by using the 'Filter-Command' with e.g. 'perl - npe s/\x0B/\n/g' it only takes a few seconds.
I could image that the speed problem arises if the Find/Replace routine has to insert '\n'.
Yes the problem has to do with the new lines created being processed by the parser immediately. Unless I am mistaken though, this will be fixed in 2.0, so if that's the case then I wouldn't expect any changes before 2.0.
Hans
Haris Skiadas Department of Mathematics and Computer Science Hanover College
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
On 23 Mar 2007, at 13:33, Alex Mason wrote:
Could you not also search for a tab character (copy and paste it in there), and the replace with a new line char (again, C&P). wouldn't need to do the more complex regexy stuff, and would hopefully be faster.
Well, I gave it a try: with '\n' and regexp: 3:05min your suggestion without regexp: 3:01min
As Charilaos mentioned it is a problem for TM to rebuild all new inserted \n internally.
BTW: perl filter: 0:09min
On 23/03/2007, at 11:23 PM, Charilaos Skiadas wrote:
... Yes the problem has to do with the new lines created being processed by the parser immediately. Unless I am mistaken though, this will be fixed in 2.0, so if that's the case then I wouldn't expect any changes before 2.0.
Thanks for the info!
Best,
hans
On 23. Mar 2007, at 09:52, Hans-Joerg Bibiko wrote:
[...] Would it make sense to include an option or button within the Find/ Replace dialog, like 'External Replace All' or whatever, to call an external maybe perl/sed/ruby routine to do the job, esp. if I want to insert many NEW LINES?
I don't know what kind of disadvantages it would have.
The disadvantage is loss of meta data such as bookmarks, foldings, having to re-parse the file for syntax highlight. And of course, that I would have to spend time on the 1.x code base rather than use the time to get 2.0 (which will have better performance when using newlines in replacements) nearer beta stage ;)
On 31.03.2007, at 16:40, Allan Odgaard wrote:
On 23. Mar 2007, at 09:52, Hans-Joerg Bibiko wrote:
[...] Would it make sense to include an option or button within the Find/ Replace dialog, like 'External Replace All' or whatever, to call an external maybe perl/sed/ruby routine to do the job, esp. if I want to insert many NEW LINES?
I don't know what kind of disadvantages it would have.
The disadvantage is loss of meta data such as bookmarks, foldings, having to re-parse the file for syntax highlight. And of course, that I would have to spend time on the 1.x code base rather than use the time to get 2.0 (which will have better performance when using newlines in replacements) nearer beta stage ;)
OK I see. Except for bookmarks my experience is that TM is faster to re-parse a document than to replaces newlines. My suggestion was only directed towards a kind of an option for the user with some explaining notes.
BTW How can I cancel such a long-term replacement in TM? I tried apple +. etc. but finally I had to kill the entire TM process.
regards,
hans
PS sorry for the question about __CF_USER_TEXT_ENCODING. I was too lazy to look at the command line ;)