Re: [Geany-Devel] pull request on GitHub, to add GeanyHighlightSelectedWords, into Geany Plugins

2015-06-01 Thread Jiří Techet
On Sun, May 31, 2015 at 10:57 AM, Colomban Wendling <
lists@herbesfolles.org> wrote:

> Le 31/05/2015 07:41, Lex Trotman a écrit :
> > On 31 May 2015 at 11:46, Lex Trotman  wrote:
> >> On 31 May 2015 at 08:05, Thomas Martitz  wrote:
> >>> Am 30.05.2015 um 03:19 schrieb Matthew Brush:
> 
> 
>  Just because it's such a trivial search algorithm, using strstr() is
> much
>  more simple and probably more efficient than using Scintilla's API to
> find
>  text, […]
> >>
> >> So its almost certainly slower than strstr().
> >
> > And on my system strstr() is a builtin that can use any hardware
> > support available.
>
> One thing that will make strstr() sound a lot less sexy is that you
> probably actually want to find *words* rather than substrings.  Meaning
> that if the word under the cursor is "i", you probably don't want to
> highlight all "i"s in e.g. an identifier "highlighting", but only whole
> words.  And while Scintilla search has the logic for this
> (SCFIND_WHOLEWORD), it'd probably be annoying/redundant to re-do with
> the same logic.
>
> Apart that, yes, strstr() from an optimized libc like glibc will be hard
> to beat without also using very smart optimization combined with use of
> specialized CPU instruction sets.
>
> Cheers,
> Colomban
>
>
Just to clarify, when I mentioned strstr(), I meant it as an example of
using some existing implementation (instead of creating something new)
rather than suggesting strstr() is the "best" one. If there's something in
Scintilla which would make it easier to implement this feature, just go for
it. If there's some performance problem, it can always be improved
afterwards (but I don't think there will be any).

Regards,

Jiri
___
Devel mailing list
Devel@lists.geany.org
https://lists.geany.org/cgi-bin/mailman/listinfo/devel


Re: [Geany-Devel] pull request on GitHub, to add GeanyHighlightSelectedWords, into Geany Plugins

2015-06-01 Thread Colomban Wendling
Le 01/06/2015 15:48, Steven Blatnick a écrit :
> […]
>
> Odd, I don't see this reply from Marius in my inbox.  Was this in
> private separately?

No, it was sent to the mailing list just like the rest…  maybe a spam
filter got confused?

>> […]
>>
>> BTW, @Steven: search_find_text() is *NOT* part of the Geany plugin API
>> and never have been.  The fact you can use it is a issue of the way
>> Geany API was exported, and it is fixed in the dev version (meaning it
>> won't work anymore).  Not also that this never worked on Windows.

> Thanks for the information.  I wonder if any of my other plugins include
> non-API calls.  Is there an easy way to tell what is allowed and what
> shouldn't be?

Anything not in the API documentation shouldn't be used.  And as said
the current Geany development version (1.25) has this fixed so you
plugin shouldn't load anymore if it uses something it shouldn't.

> Is there a reason we don't allow plugins to tie into
> anything when they could besides trying to stop plugins from being
> overtly complicated or breaking things?

The reason is that we don't want to break the API every few minutes, so
this means it has to be defined.  This can't reasonably include every
function in Geany, as it would basically mean we can't change anything
inside Geany without potentially breaking plugins.

So we choose what to render public (based on needs basically), and we
then commit to maintain this API (to a reasonable extent, at least,
meaning we will only change it if there is an important reason to).

To use the example of search_find_text() as how non-API things can
change, this function actually changed in the 1.24 cycle [1] to fix a
real problem.

All this said, if you need a function that isn't part of the API, ask
(or make a PR!) and we'll probably be happy to add it if it makes sense.

Regards,
Colomban

[1]
http://git.geany.org/geany/commit/?id=5412a244ba903624053cdaf7393732bc3af689ea
___
Devel mailing list
Devel@lists.geany.org
https://lists.geany.org/cgi-bin/mailman/listinfo/devel


Re: [Geany-Devel] pull request on GitHub, to add GeanyHighlightSelectedWords, into Geany Plugins

2015-06-01 Thread Steven Blatnick
Thanks Matthew.  I was wondering how to tell what was API. (Colomban can 
disregard that question in the other email).


On 05/29/2015 08:29 PM, Matthew Brush wrote:

Lessons learned:
  - Messing with build system flags can affect API (and ABI for that 
matter) without ever touching the code itself.
  - Never use any function that isn't explicitly listed in Geany's 
Doxygen documentation. Even if a function has no or incomplete 
documentation, if it shows up in the API reference docs (ie. has a /** 
or similar Doxyen comment), it's safe to use, otherwise it probably 
should be, or it's a bug. 


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


Re: [Geany-Devel] pull request on GitHub, to add GeanyHighlightSelectedWords, into Geany Plugins

2015-06-01 Thread Steven Blatnick

Responses:

On 05/29/2015 07:21 PM, Colomban Wendling wrote:

Le 29/05/2015 00:10, marius buzea a écrit :

   
https://github.com/sblatnick/geany-plugins/blob/master/quick-search/src/quick-search.c.

[…]

The quick-search.c calls Geany's search_find_text several times in one
processing, and each time a regex would be recompiled in search_find_text.
This is, I guess, a small cost when the regex is just a string.
Odd, I don't see this reply from Marius in my inbox.  Was this in 
private separately?

search_find_text() doesn't do regex search when the flags don't ask for
it, it only uses SCI_FINDTEXT().

=

BTW, @Steven: search_find_text() is *NOT* part of the Geany plugin API
and never have been.  The fact you can use it is a issue of the way
Geany API was exported, and it is fixed in the dev version (meaning it
won't work anymore).  Not also that this never worked on Windows.
Thanks for the information.  I wonder if any of my other plugins include 
non-API calls.  Is there an easy way to tell what is allowed and what 
shouldn't be?  Is there a reason we don't allow plugins to tie into 
anything when they could besides trying to stop plugins from being 
overtly complicated or breaking things?


If you need the function, tell us and we can probably add it.  Though
here all you need is SCI_FINDTEXT, that is already available through
sicnitlla_send_commend(sci, SCI_FINDTEXT, flags, ttf).

Ok, I'll look into that.

Thanks,

Steve
___
Devel mailing list
Devel@lists.geany.org
https://lists.geany.org/cgi-bin/mailman/listinfo/devel


Re: [Geany-Devel] pull request on GitHub, to add GeanyHighlightSelectedWords, into Geany Plugins

2015-06-01 Thread Steven Blatnick
I kind of like the idea of selection highlighting being separate 
highlighting from the search highlighting.  That allows you to have 
multiple groups highlighted differently, which has come in handy in 
using plugin versions of these features.  Alternatively, perhaps we 
could add having multiple search groups, but that may be more 
complicated or less intuitive.


On 05/29/2015 07:09 PM, Colomban Wendling wrote:

E.g, have a setting in the preferences "Dynamically mark the current
word" that decides whether mark all is dynamic or not, and have
shift+ctrl+m toggle the marking, whether it's dynamic or not.


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