On Mon, 27 Feb 2012 08:23:41 +1100 Lex Trotman elextr@gmail.com wrote:
[...]
My personal preference would be some shared static function that any plugin using markers could access.
A simple ui_utils function to find and return the first available marker based on SC_MARK_AVAILABLE would suffice.
The absolute minimum we need is for Geany to set unused markers to available. Geany has to do this, it is the only thing *guaranteed* to run before all plugins.
Fraser #2 states this, but it won't be enough. In fact, it may be useful only for programs with a single SciObj, such as SciTE.
It is not clear to me if it has to be done for each scintilla buffer, each view or once only.
For each buffer (each SciObj), I guarantee...
Plugins or Geany can then simply search for the next available one. and allocate it by setting it to something other than available.
Since a plugin may not need to set [all of] it's markers for each file, and we may even have 0 buffers open, a guint map seems required, and I was probably wrong to suggest AVAILABLE. Can't query/define Scintilla markers without at least 1 SciObj...
Since every mark using plugin should do it it is probably better to have a common function in Geany.
utils_ui_get_marker(), utils_ui_free_marker().
It can then also generate a message to the user suggesting unloading a plugin if it runs out of markers.
Shoudn't the plugin handle this? It may reduce the number of markers used, work without them if non-critical, or do something else.
Bookmarks should also be re-written to only use the number of markers as current bookmarks, not grab ten at startup.
Ten markers? Wow, that's heavy. Different colors or what?