On 26 Dec 2007, at 14:28, Сергей Яковлев wrote:
[...] is it possible to put this fix into some standard TextMate bundle like Text.tmbundle, so that all TextMate users enjoy it?
Looks good. I plan to do a TM build in a few days, I will commit your macros after that, just to allow for a little time of testing, in the case of unforeseen side effects (not that I think there is any).
[...] What is the best way to do it?
Writing this list or finding someone on IRC with authority is ideal.
[...] Suggestion 1. It would be useful if TextMate had variables like $TM_SELECTION_START and $TM_SELECTION_END which would return the corresponding offsets in the file (or the cursor offset, if nothing is selected).
It does in the form of a line/column position of the start position.
The reason it does not use a byte offset is that internally TM would have to “calculate” this (by adding the length of each line preceding the selection) and I am generally wary of exporting shell variables that need to be calculated and have an unknown running time (i.e. in practice the user could have a million lines and each command execution would then always require a million numbers to be added together).
Suggestion 2. Add a way to set "global" environment variables programmatically (from commands). These "global" variables should be available to all subsequently called commands (and other bundle items) until explicitly unset.
Technically you can store your variables e.g. in /tmp/my_variables.txt and let the command work with that file.
Environment variables are inherited by child processes, but the parent process cannot read modifications done to the environment inherited by the child. So even as a “native” feature, it would not be as graceful as simply interacting with the standard environment and declaring some variables “global” (like you sort of do with “export «variable»” in a shell script).
That said, there could certainly be support surpassing the comfort of / tmp/my_variables.txt, and it is being considered :)
Suggestion 3. Replace output options "Insert as Text" and "Insert as Snippet" with just one option, "Insert", and add a checkbox "as Snippet" to the right. [...]
In the future the input/output options will (likely) be broken up into “location” and “format”, which should give more flexibility yet still provide a simple interface.
Suggestion 4. Replace All should not alter current selection if no matches are found.
I could have sworn it didn’t ;)
The only remaining question is what symbol to use as a mark. I decided to use √ (221A, SQUARE ROOT character, which you can type with Option-V), but I'm not sure this is the best choice. Maybe it's better to use some character from Private Use Area (E000--F8FF)?
We generally use U+FFFC, OBJECT REPLACEMENT CHARACTER.