[TxMt] Re: [TM2] DIALOG2 replace input via HTML Javascript TextMate.system()

Hans-Jörg Bibiko bibiko at eva.mpg.de
Sun Sep 28 09:19:06 UTC 2014


On 28 Sep 2014, at 10:44, Allan Odgaard <mailinglist at textmate.org> wrote:

> On 27 Sep 2014, at 18:41, Hans-Jörg Bibiko wrote:
> 
>> Is it possible for a command (Input: “Selection” - fallback to “Line” ; Output: HTML window) to replace the "Input selection" via Javascript's TextMate.system()?
>> 
>> TextMate.system("$DIALOG x-insert --text 'foo'", null) works but only for a selection and not for the fallback situation.
>> 
>> Has anyone an idea?
> 
> Untested, but you could run this if TM_SELECTED_TEXT is unset:
> 
>    TextMate.system('"$TM_MATE" -l"$TM_LINE_NUMBER-$((TM_LINE_NUMBER+1))"', null)

Haha - holy ..., it works like a charm :) Allan, thanks a lot, you saved my day!

I've already played with "mate" but I didn't come up with the obvious one.
If this works then I thought that this should also work:

TextMate.system('"$TM_MATE" -l"$TM_LINE_NUMBER:1-$TM_LINE_NUMBER:1000000"', null)

and yes :) - due to that this scripting language I'm working on does not allow long lines.


So my line of code is now:

TextMate.system('[[ -z $TM_SELECTED_TEXT ]] && "$TM_MATE" -l"$TM_LINE_NUMBER:1-$TM_LINE_NUMBER:1000000"', null);


Kind regards,
Hans




More information about the textmate mailing list