Skip to content

Instantly share code, notes, and snippets.

@b4n
Last active August 29, 2015 14:20
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save b4n/0f686a2fadaca04cc619 to your computer and use it in GitHub Desktop.
Save b4n/0f686a2fadaca04cc619 to your computer and use it in GitHub Desktop.
Test Scintilla indicators in Geany
#include <geanyplugin.h>
#include <glib.h>
GeanyData *geany_data;
GeanyFunctions *geany_functions;
GeanyPlugin *geany_plugin;
PLUGIN_VERSION_CHECK(200 /* FIXME */)
PLUGIN_SET_INFO("indictest", "Tests indicators", "0", "b4n")
void plugin_init(GeanyData *data)
{
struct {
const gchar *desc;
gint indic;
} indicators[] = {
#define EX(x) #x
#define I(x) { #x "=" EX(x) "\n", x }
I(INDIC_PLAIN),
I(INDIC_SQUIGGLE),
I(INDIC_TT),
I(INDIC_DIAGONAL),
I(INDIC_STRIKE),
I(INDIC_HIDDEN),
I(INDIC_BOX),
I(INDIC_ROUNDBOX),
I(INDIC_STRAIGHTBOX),
I(INDIC_DASH),
I(INDIC_DOTS),
I(INDIC_SQUIGGLELOW),
I(INDIC_DOTBOX),
I(INDIC_SQUIGGLEPIXMAP),
I(INDIC_COMPOSITIONTHICK),
I(INDIC_COMPOSITIONTHIN),
I(INDIC_FULLBOX),
I(INDIC_TEXTFORE)
#undef I
#undef EX
};
GeanyDocument *doc;
ScintillaObject *sci;
guint pos = 0;
guint i;
doc = document_new_file("Indicators", NULL, NULL);
sci = doc->editor->sci;
scintilla_send_message(sci, SCI_CLEARALL, 0, 0);
for (i = 0; i < G_N_ELEMENTS(indicators); i++) {
guint line_len = strlen(indicators[i].desc);
scintilla_send_message(sci, SCI_INSERTTEXT, pos, (sptr_t) indicators[i].desc);
scintilla_send_message(sci, SCI_INDICSETSTYLE, INDIC_CONTAINER + i, indicators[i].indic);
scintilla_send_message(sci, SCI_SETINDICATORCURRENT, INDIC_CONTAINER + i, 0);
scintilla_send_message(sci, SCI_INDICATORFILLRANGE, pos, line_len);
pos += line_len;
}
}
void plugin_cleanup(void) {}
#!/usr/bin/make -f
PLUGIN = indictest
VPATH ?= .
# fetch from https://github.com/b4n/geany-plugin.mk
include $(VPATH)/geany-plugin.mk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment