diff options
author | rbuj <[email protected]> | 2020-07-25 00:10:44 +0200 |
---|---|---|
committer | raveit65 <[email protected]> | 2020-08-26 11:48:33 +0200 |
commit | 552b9078171a5ae65a619c1e2c12da7ab4d01e42 (patch) | |
tree | a4de2fe89f647c42bf8dbe604944d6ca3a2cfca1 | |
parent | f64f6566280e408adff0014fa07c3f6c321fa8c2 (diff) | |
download | pluma-552b9078171a5ae65a619c1e2c12da7ab4d01e42.tar.bz2 pluma-552b9078171a5ae65a619c1e2c12da7ab4d01e42.tar.xz |
pluma-document: Fix BOM detection for C language
-rw-r--r-- | pluma/pluma-document.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/pluma/pluma-document.c b/pluma/pluma-document.c index 742b7c92..a7691f45 100644 --- a/pluma/pluma-document.c +++ b/pluma/pluma-document.c @@ -699,7 +699,12 @@ set_language (PlumaDocument *doc, gboolean set_by_user) { GtkSourceLanguage *old_lang; - const gchar *bom_langs; + const gchar *new_lang_id; + const gchar *bom_langs[] = { + "asp", "dtl", "docbook", "html", "mxml", "mallard", "markdown", + "mediawiki", "php", "tera", "xml", "xslt", NULL + }; + gboolean is_bom_lang = FALSE; pluma_debug (DEBUG_DOCUMENT); @@ -708,9 +713,11 @@ set_language (PlumaDocument *doc, if (old_lang == lang) return; - bom_langs = "asp,dtl,docbook,html,mxml,mallard,markdown,mediawiki,php,tera,xml,xslt"; + new_lang_id = gtk_source_language_get_id (lang); + if (new_lang_id) + is_bom_lang = g_strv_contains (bom_langs, new_lang_id); - if (g_strrstr (bom_langs, gtk_source_language_get_id (lang))) + if (is_bom_lang) { GFile *file; |