[TxMt] Re: replacement broken when using regexp look-ahead?

Allan Odgaard mailinglist at textmate.org
Sun Feb 19 11:09:17 UTC 2012

On 17/02/2012, at 23.38, Erik Neumann wrote:

> […] However, the "replace" button in the Find dialog seems to do something different from the "replace all in selection" command.  The "replace" button seems to be "do the find once in the selection, and then replace the entire selection using the result of the first successful match".

Replace is effectively just “overwrite selection with the content of the replace field” but if the latter is a regexp, it tries needs to match the find string against the selection for potential captures for the format string expansion.

This is a lot simpler than having to store state about last find action and I think I tested a few other applications and found they did the same before I did it. I want to change it in 2.0 though still haven’t added the proper “remember last find” state.

> […] Maybe put a note in the help file that the replace button is really "replace selection with result of first match in selection"?

I think this is the second or third time it has come up in the 7 years TextMate has done this. Doubt that number would have been lower if it was explicitly spelled out in the help book ;)

More information about the textmate mailing list