[TxMt] Re: Changing the selection in a script/command

Richard Drake rdrake98 at gmail.com
Sun Oct 12 07:55:05 UTC 2014


Brilliant, thanks


07952130635
skype: rdrake98
blog <https://dl.dropboxusercontent.com/u/51971271/drake/index.html> -
twitter <https://twitter.com/rdrake98>

On 12 October 2014 08:46, Allan Odgaard <mailinglist at textmate.org> wrote:

> On 12 Oct 2014, at 9:25, Richard Drake wrote:
>
>  Thanks René
>>
>> You gave me the crucial clue but, for the record, it's (for example)
>>
>> TM_SELECTED_TEXT="some text"
>> TM_SELECTION="14:6-14:15"
>>
>> and it's the second one I was missing.
>>
>
> For the records, TM_SELECTION follows the selection string syntax
> documented here: http://manual.textmate.org/references.html#selection-
> string
>
> For example with multiple selections or columnar selections, you will see
> & and x in the string, and with “freehanded” placement of caret (e.g.
> option click past end of line) you will see + (which can also occur for
> column selections).
>
> I think a regexp like this can be used for a simple parser:
>
>     /^(\d+)(?::(\d+))?(?:\+\d+)?(-|x)(\d+)(?::(\d+))?(?:\+\d+)?(?:&.*)?$/
>
>         $1 = from line
>         $2 = from column
>         $3 = - or x indicating regular or columnar selection
>         $4 = to line
>         $5 = to column
>
> I didn’t capture the “past EOL offsets”.
>
>
> _______________________________________________
> textmate mailing list
> textmate at lists.macromates.com
> http://lists.macromates.com/listinfo/textmate
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macromates.com/textmate/attachments/20141012/9c1cd40a/attachment.html>


More information about the textmate mailing list