Re: [code] [Textadept] Problem with URI_DROPPED

From: Giovanni Salmeri <>
Date: Sun, 26 Feb 2017 14:37:10 +0100

Just a little doubt out of curiosity: Scintilla seems to know very well
which is the buffer position closest to the mouse coordinates, because
when I drag a file into the document I see the *caret* (non only the
mouse pointer) moving accordingly. So I imagine that if Scintilla
exposed in the event SCN_URI_DROPPED this value (which it anyway
calculates!), it would be sufficient something like this:

events.connect(events.URI_DROPPED, function(uri, position)
        buffer:insert_text(position, uri)
        return true
end, 1)

If this is right, I could make a request to the developper of
Scintilla, and (almost) no code should be added to Textadept. But
perhaps I am completely wrong!

On Sat, 25 Feb 2017 10:46:55 -0500 (EST) Mitchell <> wrote:

> Hi Giovanni,
> On Sat, 25 Feb 2017, Giovanni Salmeri wrote:
> > Hello everybody.
> >
> > I am trying to accomplish a rather simple thing: when I drop a
> > filename in a document, I would like that the filename be added to
> > the text. I tried with the following code:
> >
> > events.connect(events.URI_DROPPED, function(uri)
> > buffer:add_text(uri)
> > return true
> > end, 1)
> >
> > ... and it sort of works. The problem is that the filename is
> > added, but not where I drop it, but rather where the caret was
> > before dropping the filename. I cannot figure out a solution, and I
> > suspect that this is a limit of Scintilla. Any suggestions or ideas?
> This is not exactly a limitation of Scintilla, but of Textadept.
> Textadept does not provide an API to fetch the current position of
> the mouse. If it did, you could ask Scintilla for the buffer position
> closest to those mouse coordinates, and then insert text there.
> The only solution I can think of is to place the buffer caret where
> you want the filename to be inserted, and then drag the filename into
> Textadept. It's not ideal, but it's something.
> Cheers,
> Mitchell

Giovanni Salmeri
You are subscribed to
To change subscription settings, send an e-mail to
To unsubscribe, send an e-mail to
Received on Sun 26 Feb 2017 - 08:37:10 EST

This archive was generated by hypermail 2.2.0 : Mon 27 Feb 2017 - 06:30:27 EST