Hi All,
OK, after further research I have stumbled on the answer:
As well as adding the GEANY_API_SYMBOL macro to the function definition, the function declaration in keybindings.h also needs to be moved from the #ifdef GEANY_PRIVATE section, into the 'public' section. Dereffing the returned pointer then works fine.
I expect this is documented somewhere, though I haven't found it. Thanks to all for not responding with 'RTFM'. :)
Cheers, Austin.
On Tue, 27 Aug 2019 at 14:29, Austin Green austin.green@orcon.net.nz wrote:
Hi All,
OK, after further research I have stumbled on the answer:
As well as adding the GEANY_API_SYMBOL macro to the function definition, the function declaration in keybindings.h also needs to be moved from the #ifdef GEANY_PRIVATE section, into the 'public' section. Dereffing the returned pointer then works fine.
I expect this is documented somewhere, though I haven't found it.
Its not documented because its private, its not for plugin use. Things are not just randomly added to the plugin API, because then its fixed and can't be changed inside Geany.
Thanks to all for not responding with 'RTFM' :)
Would therefore have been a RTFC :)
Cheers Lex
Cheers, Austin. _______________________________________________ Devel mailing list Devel@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/devel
Hi Lex,
On Tue, 27 Aug 2019 14:39:52 +1000 Lex Trotman elextr@gmail.com wrote:
On Tue, 27 Aug 2019 at 14:29, Austin Green austin.green@orcon.net.nz wrote: ...
As well as adding the GEANY_API_SYMBOL macro to the function definition, the function declaration in keybindings.h also needs to be moved from the #ifdef GEANY_PRIVATE section, into the 'public' section. Dereffing the returned pointer then works fine.
I expect this is documented somewhere, though I haven't found it.
Its not documented because its private, its not for plugin use. Things are not just randomly added to the plugin API, because then its fixed and can't be changed inside Geany.
Presumably it _could_ be added to the API, but only by the Geany maintainers? Who would need to have a good use case made for it.
Cheers, Austin.
On Tue, 27 Aug 2019 at 16:00, Austin Green austin.green@orcon.net.nz wrote:
Hi Lex,
On Tue, 27 Aug 2019 14:39:52 +1000 Lex Trotman elextr@gmail.com wrote:
On Tue, 27 Aug 2019 at 14:29, Austin Green austin.green@orcon.net.nz wrote: ...
As well as adding the GEANY_API_SYMBOL macro to the function definition, the function declaration in keybindings.h also needs to be moved from the #ifdef GEANY_PRIVATE section, into the 'public' section. Dereffing the returned pointer then works fine.
I expect this is documented somewhere, though I haven't found it.
Its not documented because its private, its not for plugin use. Things are not just randomly added to the plugin API, because then its fixed and can't be changed inside Geany.
Presumably it _could_ be added to the API, but only by the Geany maintainers? Who would need to have a good use case made for it.
A fair interpretation, yeah. Luckily you found you didn't need it anyway :)
Cheers Lex
Cheers, Austin. _______________________________________________ Devel mailing list Devel@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/devel
Thanks, this info should be added to HACKING to explain how to add API symbols.
On Tue, 27 Aug 2019 05:29 Austin Green, austin.green@orcon.net.nz wrote:
Hi All,
OK, after further research I have stumbled on the answer:
As well as adding the GEANY_API_SYMBOL macro to the function definition, the function declaration in keybindings.h also needs to be moved from the #ifdef GEANY_PRIVATE section, into the 'public' section. Dereffing the returned pointer then works fine.
I expect this is documented somewhere, though I haven't found it. Thanks to all for not responding with 'RTFM'. :)
Cheers, Austin. _______________________________________________ Devel mailing list Devel@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/devel
Trying to programmatically cancel a text selection. There are functions that will probably do it, e.g. sci_set_selection, but bearing in mind the restriction on changing the API, those functions are not callable from my code.
Surely I'm missing something obvious here? I do hope so! :)
Cheers, Austin.
On Wed, 28 Aug 2019 at 15:12, Austin Green austin.green@orcon.net.nz wrote:
Trying to programmatically cancel a text selection. There are functions that will probably do it, e.g. sci_set_selection, but bearing in mind the restriction on changing the API, those functions are not callable from my code.
Surely I'm missing something obvious here? I do hope so! :)
Scintilla docs say "If the anchor and the current position are the same, there is no selected text." so probably set selection start and end both to current position. https://www.geany.org/manual/reference/sciwrappers_8h.html#a6649bca185bcc348...
Cheers Lex
Cheers, Austin. _______________________________________________ Devel mailing list Devel@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/devel
Hi Lex,
Trying to programmatically cancel a text selection. There are functions that will probably do it, e.g. sci_set_selection, but bearing in mind the restriction on changing the API, those functions are not callable from my code. Surely I'm missing something obvious here? I do hope so! :)
Scintilla docs say "If the anchor and the current position are the same, there is no selected text." so probably set selection start and end both to current position. https://www.geany.org/manual/reference/sciwrappers_8h.html#a6649bca185bcc348... Cheers Lex
Yes, that's what I tried first. It only appears to have no selection -- as soon as I move the caret, it starts selecting again (even without the shift key!) So appears to have gone into a strange extend-selection-just-by-moving mode. I can make it return to normal by hitting ESC and then an arrow key, or by again setting the selection start and end points the to the same position. Weird or what?
Cheers, Austin.
Le 28/08/2019 à 12:38, Austin Green a écrit :
[…]> Yes, that's what I tried first. It only appears to have no selection -- as soon as I move the caret, it starts selecting again (even without the shift key!) So appears to have gone into a strange extend-selection-just-by-moving mode. I can make it return to normal by hitting ESC and then an arrow key, or by again setting the selection start and end points the to the same position. Weird or what?
It would help to know what you're trying to achieve, and what you're currently doing :) AFAICT you didn't mention that in either threads -- or I missed it.
FWIW, you can use pretty much all of the Scintilla message API for interacting with the document, in addition to helpers & co Geany might expose, see https://scintilla.org/ScintillaDoc.html
Regards, Colmban
On Wed, 28 Aug 2019 at 20:38, Austin Green austin.green@orcon.net.nz wrote:
Hi Lex,
Trying to programmatically cancel a text selection. There are functions that will probably do it, e.g. sci_set_selection, but bearing in mind the restriction on changing the API, those functions are not callable from my code. Surely I'm missing something obvious here? I do hope so! :)
Scintilla docs say "If the anchor and the current position are the same, there is no selected text." so probably set selection start and end both to current position. https://www.geany.org/manual/reference/sciwrappers_8h.html#a6649bca185bcc348... Cheers Lex
Yes, that's what I tried first. It only appears to have no selection -- as soon as I move the caret, it starts selecting again (even without the shift key!) So appears to have gone into a strange extend-selection-just-by-moving mode. I can make it return to normal by hitting ESC and then an arrow key, or by again setting the selection start and end points the to the same position. Weird or what?
No, that makes sense now you say it, after all you have set the anchor, so when you (or the user) move the cursor, Scintilla considers between anchor and cursor to be the selection.
Scintilla docs say:
SCI_SETSEL(position anchor, position caret) This message sets both the anchor and the current position. If caret is negative, it means the end of the document. If anchor is negative, it means remove any selection (i.e. set the anchor to the same position as caret). The caret is scrolled into view after this operation.
And you can send that using scintilla_send_message() which is in the API.
Cheers Lex
Cheers, Austin. _______________________________________________ Devel mailing list Devel@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/devel
SCI_SETSEL(position anchor, position caret) ... scintilla_send_message() which is in the API
@Lex: Yay! SCI_SETSEL was right on target! Or "rem acu tetigiste" as the Romans used to say. Overnight my brain had come up with the idea of investigating the Scintilla message API, so you saved me some work. Thanks heaps.
Scintilla message API ... see https://scintilla.org/ScintillaDoc.html
@Colomban: it wasn't specially relevant, but I'm modding the "addons" plugin to add a few features from SlickEdit that I miss, one of which is deselecting after a copy. Thanks heaps to you too for the Scintilla message suggestion.
Cheers, Austin.