Retrieve the position under mouse cursor?

50 views
Skip to first unread message

Mikhail V

unread,
Dec 15, 2017, 8:43:54 PM12/15/17
to scintilla-interest
Is there an API command to retrieve the char position
under the mouse cursor, i.e. without moving the caret there?

I am browsing the API reference but cannot find such command.
This could be useful for example for pasting text without the
need to move the caret in the target position.

A related question - is the position calculation after a mouse click
is performed fully by Scintilla, or it relies on some 3d party calls?
Does Scintilla build and access glyph anchor coordinate sets?

From what I observe in NPP, for example with Arabic input, it behaves
same as in some native Windows widgets, so this suggests that Scintilla
relies on 3d party functionality, i.e. some Windows subsystem.
Am I right?



Mikhail

Colomban Wendling

unread,
Dec 16, 2017, 4:53:23 PM12/16/17
to scintilla...@googlegroups.com
Le 15/12/2017 à 17:43, Mikhail V a écrit :
> Is there an API command to retrieve the char position
> under the mouse cursor, i.e. without moving the caret there?

http://scintilla.org/ScintillaDoc.html#SCI_POSITIONFROMPOINT

Use those methods combined with whatever the platform has to give you
the mouse coordinates, relative to Scintilla's widget.

Cheers,
Colomban

Neil Hodgson

unread,
Dec 18, 2017, 4:34:19 AM12/18/17
to scintilla...@googlegroups.com
Mikhail V:

> A related question - is the position calculation after a mouse click
> is performed fully by Scintilla, or it relies on some 3d party calls?
> Does Scintilla build and access glyph anchor coordinate sets?

Its a combination of Scintilla’s idea of how the text should be laid out and measurements from the platform layer of the positions of each character in single-style segments of text. The most important call for layout is Surface::MeasureWidths.

> From what I observe in NPP, for example with Arabic input, it behaves
> same as in some native Windows widgets, so this suggests that Scintilla
> relies on 3d party functionality, i.e. some Windows subsystem.
> Am I right?

Scintilla’s behaviour with Arabic input on Windows is currently wrong which is the subject of the “Adding R2L…” thread. The R2L patch set changes the way that layout is performed by depending more on platform calls which understand bidirectional layout.

Neil

Reply all
Reply to author
Forward
0 new messages