static gboolean automark(gpointer user_data) { GeanyDocument *doc = (GeanyDocument *)user_data; GeanyEditor *editor = doc->editor; static GeanyEditor *editor_cache = NULL; ScintillaObject *sci = editor->sci; gchar text[GEANY_MAX_WORD_LENGTH]; static gchar text_cache[GEANY_MAX_WORD_LENGTH] = {0}; gint match_flag = SCFIND_MATCHCASE | SCFIND_WHOLEWORD; struct Sci_TextToFind ttf; source_id = 0; /* during timeout document could be destroyed so check everything again */ if (!DOC_VALID(doc)) return FALSE; /* Do not highlight while selecting text and allow other markers to work */ if (sci_has_selection(sci)) return FALSE; get_current_word(editor->sci, text, sizeof(text)); if (!*text) { editor_indicator_clear(editor, AUTOMARK_INDICATOR); return FALSE; } if (editor_cache != editor || strcmp(text, text_cache) != 0) { editor_indicator_clear(editor, AUTOMARK_INDICATOR); strcpy(text_cache, text); editor_cache = editor; } gint vis_first = SSM(sci, SCI_GETFIRSTVISIBLELINE, 0, 0); gint doc_first = SSM(sci, SCI_DOCLINEFROMVISIBLE, vis_first, 0); gint vis_last = SSM(sci, SCI_LINESONSCREEN, 0, 0) + vis_first; gint doc_last = SSM(sci, SCI_DOCLINEFROMVISIBLE, vis_last, 0); gint start = SSM(sci, SCI_POSITIONFROMLINE, doc_first, 0); gint end = SSM(sci, SCI_GETLINEENDPOSITION, doc_last, 0); ttf.chrg.cpMin = start; ttf.chrg.cpMax = end; ttf.lpstrText = text; search_mark_in_range(editor, match_flag, &ttf); return FALSE; }
static PyObject * Editor_indicator_clear(Editor *self, PyObject *args, PyObject *kwargs) { gint indic; static gchar *kwlist[] = { "indic", NULL }; if (PyArg_ParseTupleAndKeywords(args, kwargs, "i", kwlist, &indic)) editor_indicator_clear(self->editor, indic); Py_RETURN_NONE; }
static void clear_spellcheck_error_markers(GeanyDocument *doc) { editor_indicator_clear(doc->editor, GEANY_INDICATOR_ERROR); }