From 552b9078171a5ae65a619c1e2c12da7ab4d01e42 Mon Sep 17 00:00:00 2001 From: rbuj Date: Sat, 25 Jul 2020 00:10:44 +0200 Subject: pluma-document: Fix BOM detection for C language --- pluma/pluma-document.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'pluma') 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; -- cgit v1.2.1