Re: [code] [Textadept] Problem with URI_DROPPED

From: Mitchell <m.att.foicica.com>
Date: Sat, 25 Feb 2017 10:46:55 -0500 (EST)

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

-- 
You are subscribed to code.att.foicica.com.
To change subscription settings, send an e-mail to code+help.att.foicica.com.
To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
Received on Sat 25 Feb 2017 - 10:46:55 EST

This archive was generated by hypermail 2.2.0 : Sun 26 Feb 2017 - 06:27:00 EST