Re: [Geany-Devel] How to programmatically de-select text -- solved

2019-08-28 Thread Austin Green

> 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.
___
Devel mailing list
Devel@lists.geany.org
https://lists.geany.org/cgi-bin/mailman/listinfo/devel


Re: [Geany-Devel] How to programmatically de-select text

2019-08-28 Thread Lex Trotman
On Wed, 28 Aug 2019 at 20:38, Austin Green  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#a6649bca185bcc34837642cb61b4e7791
> > 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
___
Devel mailing list
Devel@lists.geany.org
https://lists.geany.org/cgi-bin/mailman/listinfo/devel


Re: [Geany-Devel] How to programmatically de-select text

2019-08-28 Thread Austin Green
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#a6649bca185bcc34837642cb61b4e7791
> 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.
___
Devel mailing list
Devel@lists.geany.org
https://lists.geany.org/cgi-bin/mailman/listinfo/devel


Re: [Geany-Devel] How to programmatically de-select text

2019-08-27 Thread Lex Trotman
On Wed, 28 Aug 2019 at 15:12, Austin Green  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#a6649bca185bcc34837642cb61b4e7791

Cheers
Lex

>
> Cheers, Austin.
> ___
> Devel mailing list
> Devel@lists.geany.org
> https://lists.geany.org/cgi-bin/mailman/listinfo/devel
___
Devel mailing list
Devel@lists.geany.org
https://lists.geany.org/cgi-bin/mailman/listinfo/devel