[TxMt] Re: tm_dialog question (maybe a feature request)

Trevor Squires trevor at protocool.com
Thu Jun 12 17:40:55 UTC 2008

Hi Allan, thanks for responding.

My comments are inline below:

On 6/11/08, Allan Odgaard <mailinglist at textmate.org> wrote:
> On 6 Jun 2008, at 00:29, Trevor Squires wrote:
> > after tinkering with tm_dialog for a plugin[1] I have come to really
> > wish you could embed an 'html output' webview into a NIB.
> > [...]
> >
>  What functionality do you expect of such thing? The HTML output window is
> not much more than a WebView, no real API here. It is asked to load
> "tm-internal://«id»" which triggers a custom URL handler which is
> responsible for feeding the NSURLConnection with data from the command
> running.

There looks to be some other wiring in the html output nib file,
setting up webview delegates, exposing 'TextMate' as a javascript
object (I *think*), as well as connecting up the progress indicator
etc.  I've assumed that some of that is to ensure closing the window
triggers sub-process termination.

My tiny mind can't see any way of *not* having those connections in
place so I'm assuming they'd still be important.  (more below)

>  So if I understand your goal correctly, you would probably be much more
> interested in this custom URL handler.
>  E.g. when you want to execute a search, you open whatever window you
> defined in your nib containing just an instance of a WebView, and you bind
> the URL of this WebView so that you can ask it to load something like:
> tm-run-command:///usr/bin/find?arg1=.&arg2=-name%3D*.rb/
> (just making up URL scheme for illustrative purposes).

Yeah, on the surface that looks like the ticket except that WebView
doesn't expose the MainFrameURL in a way that I can see to wire it up
to the params controller.

At best you can tell a control to send takeStringURLFrom: to the
WebView but that won't get sent if you just update the control's value
via bindings.

And as you will be building the URL string based on input from the
controls it means you'll have to return control to a script waiting on
tm_dialog results so that the params can be updated with the new URL
string.  ... but the WebView won't respond to the params change.

So creating a tm-run-command URL handler would definitely be part of
the solution but I think there's more to it.  i.e. process management
and some way to poke the webview into action based on a params change.


Trevor Squires

More information about the textmate mailing list