[Geany-Devel] Plugin development questions

Colomban Wendling lists.ban at xxxxx
Mon Oct 7 12:40:24 UTC 2013

Hi Matias,

Le 07/10/2013 12:27, v01d a écrit :
> Hi, I'm writing a simple plugin for geany (which I will call 
> LiveDiff) which allows for having indicators inside the editor for 
> changed/added/modified lines, which is updated as you type. The base 
> for comparing the buffer can be either the version of the file on 
> disk or (which I will soon attempt to add) the latest version from 
> the git repository, if the file is versioned so.

Sounds neat!  I wanted to add such thing to a Git plugin I started, but
I never took the time to continue it :/

> This resembles what netbeans does (one something I really liked). So
> far it works OK but there are some quirks. I'm doing this out of
> spare time so dont expect a pretty serious commitement to it. I will
> however make it available on github.
> I wanted to ask regarding the ScitillaObject handling. Currently my 
> plugin needs to define RGBA markers (which are used to indicate the 
> diff results per-line). What it is not really clear to me is that 
> there appears to be one ScintillaObject associated with each 
> GeanyDocument. However, some messages sent to the ScintillaObject 
> (like changing the margin or defining markers) appear to be global 
> across all instances (unless I'm mistaken). Is this so?

No it's not, each ScintillaObject only represents one editing component
and fires event for it.  I can't think of any reason why it could be
wrong, unless we have a serious bug somewhere, but that's very unlikely
since it'd break more than just your plugin ^^

> What would be the proper handling? Is it ok to repeat the definition 
> of the markers for each editor?

Yes, since each editor have a separate marker handling (since it's a
separate ScintillaObject), you have to re-define the markers for each

> Moreover, I'm not sure how to handle correctly the size of the RGBA 
> markers since it depends on the font size of the editor. I tried to 
> set the marker scale using the text_height to image height ratio,
> but the marker still appears to be a bit taller than the line and
> this creates some visual artifacts.

I'm not quite sure right now without any testing, but couldn't you end
up with a fractional value that gets wrongly rounded or something?
Sorry, I'm not so familiar with markers.
BTW, couldn't you use one of the builtin markers instead of an image?
Like a green SC_MARK_PLUS and a yellow SC_MARK_FULLRECT or something?
If this is ok for you it would save you from having to bother image
definition, loading, scaling, whatever.


More information about the Devel mailing list