Created
October 16, 2011 08:54
-
-
Save codebrainz/1290680 to your computer and use it in GitHub Desktop.
Use `document_update_highlighting()` in favour of `update_type_keywords()`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/src/document.c b/src/document.c | |
| index 57d5881..cdd8015 100644 | |
| --- a/src/document.c | |
| +++ b/src/document.c | |
| @@ -2384,69 +2384,6 @@ static gboolean get_project_typenames(const GString **types, gint lang) | |
| } | |
| -/* If sci is NULL, update project typenames for all documents that support typenames, | |
| - * if typenames have changed. | |
| - * If sci is not NULL, then if sci supports typenames, project typenames are updated | |
| - * if necessary, and typename keywords are set for sci. | |
| - * Returns: TRUE if any scintilla type keywords were updated. */ | |
| -static gboolean update_type_keywords(GeanyDocument *doc, gint lang) | |
| -{ | |
| - gboolean ret = FALSE; | |
| - guint n; | |
| - const GString *s; | |
| - ScintillaObject *sci; | |
| - | |
| - g_return_val_if_fail(doc != NULL, FALSE); | |
| - sci = doc->editor->sci; | |
| - | |
| - switch (doc->file_type->id) | |
| - { /* continue working with the following languages, skip on all others */ | |
| - case GEANY_FILETYPES_C: | |
| - case GEANY_FILETYPES_CPP: | |
| - case GEANY_FILETYPES_CS: | |
| - case GEANY_FILETYPES_D: | |
| - case GEANY_FILETYPES_JAVA: | |
| - case GEANY_FILETYPES_VALA: | |
| - break; | |
| - default: | |
| - return FALSE; | |
| - } | |
| - | |
| - sci = doc->editor->sci; | |
| - if (sci != NULL && editor_lexer_get_type_keyword_idx(sci_get_lexer(sci)) == -1) | |
| - return FALSE; | |
| - | |
| - if (! get_project_typenames(&s, lang)) | |
| - { /* typenames have not changed */ | |
| - if (s != NULL && sci != NULL) | |
| - { | |
| - gint keyword_idx = editor_lexer_get_type_keyword_idx(sci_get_lexer(sci)); | |
| - | |
| - sci_set_keywords(sci, keyword_idx, s->str); | |
| - queue_colourise(doc); | |
| - } | |
| - return FALSE; | |
| - } | |
| - g_return_val_if_fail(s != NULL, FALSE); | |
| - | |
| - for (n = 0; n < documents_array->len; n++) | |
| - { | |
| - if (documents[n]->is_valid) | |
| - { | |
| - ScintillaObject *wid = documents[n]->editor->sci; | |
| - gint keyword_idx = editor_lexer_get_type_keyword_idx(sci_get_lexer(wid)); | |
| - | |
| - if (keyword_idx > 0) | |
| - { | |
| - sci_set_keywords(wid, keyword_idx, s->str); | |
| - queue_colourise(documents[n]); | |
| - ret = TRUE; | |
| - } | |
| - } | |
| - } | |
| - return ret; | |
| -} | |
| - | |
| /* | |
| * Updates the keywords in a document and re-colourizes it. | |
| * | |
| @@ -2500,14 +2437,11 @@ static void document_load_config(GeanyDocument *doc, GeanyFiletype *type, | |
| highlighting_set_styles(doc->editor->sci, type); | |
| editor_set_indentation_guides(doc->editor); | |
| build_menu_update(doc); | |
| - queue_colourise(doc); | |
| doc->priv->symbol_list_sort_mode = type->priv->symbol_list_sort_mode; | |
| } | |
| document_update_tag_list(doc, TRUE); | |
| - | |
| - /* Update session typename keywords. */ | |
| - update_type_keywords(doc, type->lang); | |
| + document_update_highlighting(doc); | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment