<div dir="ltr">Brilliant, thanks<br></div><div class="gmail_extra"><br clear="all"><div><br>07952130635<br>skype: rdrake98<br><a href="https://dl.dropboxusercontent.com/u/51971271/drake/index.html" target="_blank">blog</a> - <a href="https://twitter.com/rdrake98" target="_blank">twitter</a><br></div>
<br><div class="gmail_quote">On 12 October 2014 08:46, Allan Odgaard <span dir="ltr"><<a href="mailto:mailinglist@textmate.org" target="_blank">mailinglist@textmate.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 12 Oct 2014, at 9:25, Richard Drake wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Thanks René<br>
<br>
You gave me the crucial clue but, for the record, it's (for example)<br>
<br>
TM_SELECTED_TEXT="some text"<br>
TM_SELECTION="14:6-14:15"<br>
<br>
and it's the second one I was missing.<br>
</blockquote>
<br></span>
For the records, TM_SELECTION follows the selection string syntax documented here: <a href="http://manual.textmate.org/references.html#selection-string" target="_blank">http://manual.textmate.org/<u></u>references.html#selection-<u></u>string</a><br>
<br>
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).<br>
<br>
I think a regexp like this can be used for a simple parser:<br>
<br>
    /^(\d+)(?::(\d+))?(?:\+\d+)?(-<u></u>|x)(\d+)(?::(\d+))?(?:\+\d+)?(<u></u>?:&.*)?$/<br>
<br>
        $1 = from line<br>
        $2 = from column<br>
        $3 = - or x indicating regular or columnar selection<br>
        $4 = to line<br>
        $5 = to column<br>
<br>
I didn’t capture the “past EOL offsets”.<div class="HOEnZb"><div class="h5"><br>
<br>
______________________________<u></u>_________________<br>
textmate mailing list<br>
<a href="mailto:textmate@lists.macromates.com" target="_blank">textmate@lists.macromates.com</a><br>
<a href="http://lists.macromates.com/listinfo/textmate" target="_blank">http://lists.macromates.com/<u></u>listinfo/textmate</a></div></div></blockquote></div><br></div>