diff --git a/moo/mooedit/gtksourceview/upstream/gtksourcecontextengine.c b/moo/mooedit/gtksourceview/upstream/gtksourcecontextengine.c index ed6c14cc..a9221022 100644 --- a/moo/mooedit/gtksourceview/upstream/gtksourcecontextengine.c +++ b/moo/mooedit/gtksourceview/upstream/gtksourcecontextengine.c @@ -134,7 +134,8 @@ typedef enum { GTK_SOURCE_CONTEXT_ENGINE_ERROR_INVALID_WHERE, GTK_SOURCE_CONTEXT_ENGINE_ERROR_INVALID_START_REF, GTK_SOURCE_CONTEXT_ENGINE_ERROR_INVALID_REGEX, - GTK_SOURCE_CONTEXT_ENGINE_ERROR_INVALID_STYLE + GTK_SOURCE_CONTEXT_ENGINE_ERROR_INVALID_STYLE, + GTK_SOURCE_CONTEXT_ENGINE_ERROR_BAD_FILE } GtkSourceContextEngineError; typedef enum { @@ -2255,13 +2256,9 @@ gtk_source_context_engine_attach_buffer (GtkSourceEngine *engine, main_definition = LOOKUP_DEFINITION (ce->priv->ctx_data, root_id); g_free (root_id); - if (main_definition == NULL) - { - g_warning (_("Missing main language " - "definition (id = \"%s\".)"), - ENGINE_ID (ce)); - return; - } + /* If we don't abort here, we will crash later (#485661). But it should + * never happen, _gtk_source_context_data_finish_parse checks main context. */ + g_assert (main_definition != NULL); ce->priv->root_context = context_new (NULL, main_definition, NULL, NULL, FALSE); ce->priv->root_segment = create_segment (ce, NULL, ce->priv->root_context, 0, 0, TRUE, NULL); @@ -6183,8 +6180,11 @@ _gtk_source_context_data_finish_parse (GtkSourceContextData *ctx_data, GError **error) { struct ResolveRefData data; + gchar *root_id; + ContextDefinition *main_definition; g_return_val_if_fail (ctx_data != NULL, FALSE); + g_return_val_if_fail (ctx_data->lang != NULL, FALSE); g_return_val_if_fail (error == NULL || *error == NULL, FALSE); while (overrides != NULL) @@ -6209,10 +6209,23 @@ _gtk_source_context_data_finish_parse (GtkSourceContextData *ctx_data, g_propagate_error (error, data.error); return FALSE; } - else + + /* Engine will crash without main context, check it here (#485661) */ + root_id = g_strdup_printf ("%s:%s", ctx_data->lang->priv->id, ctx_data->lang->priv->id); + main_definition = LOOKUP_DEFINITION (ctx_data, root_id); + g_free (root_id); + + if (main_definition == NULL) { - return TRUE; + g_set_error (error, GTK_SOURCE_CONTEXT_ENGINE_ERROR, + GTK_SOURCE_CONTEXT_ENGINE_ERROR_BAD_FILE, + _("Missing main language " + "definition (id = \"%s\".)"), + ctx_data->lang->priv->id); + return FALSE; } + + return TRUE; } static void diff --git a/moo/mooedit/gtksourceview/upstream/gtksourcestyleschememanager.h b/moo/mooedit/gtksourceview/upstream/gtksourcestyleschememanager.h index 29b94175..ecac3fe1 100644 --- a/moo/mooedit/gtksourceview/upstream/gtksourcestyleschememanager.h +++ b/moo/mooedit/gtksourceview/upstream/gtksourcestyleschememanager.h @@ -58,11 +58,11 @@ struct _GtkSourceStyleSchemeManagerClass GType gtk_source_style_scheme_manager_get_type (void) G_GNUC_CONST; -GtkSourceStyleSchemeManager - *gtk_source_style_scheme_manager_new (void); +GtkSourceStyleSchemeManager * + gtk_source_style_scheme_manager_new (void); -GtkSourceStyleSchemeManager - *gtk_source_style_scheme_manager_get_default (void); +GtkSourceStyleSchemeManager * + gtk_source_style_scheme_manager_get_default (void); void gtk_source_style_scheme_manager_set_search_path (GtkSourceStyleSchemeManager *manager, gchar **path); diff --git a/moo/mooedit/language-specs/csharp.lang b/moo/mooedit/language-specs/csharp.lang index 79f770da..7c2fb9d7 100644 --- a/moo/mooedit/language-specs/csharp.lang +++ b/moo/mooedit/language-specs/csharp.lang @@ -126,6 +126,7 @@ out override params + partial private protected public diff --git a/moo/mooedit/language-specs/javascript.lang b/moo/mooedit/language-specs/javascript.lang index 91e3285b..50641a8f 100644 --- a/moo/mooedit/language-specs/javascript.lang +++ b/moo/mooedit/language-specs/javascript.lang @@ -25,7 +25,7 @@ --> - application/x-javascript;text/x-javascript;text/javascript;text/x-js + application/javascript;application/x-javascript;text/x-javascript;text/javascript;text/x-js *.js // /* diff --git a/moo/mooedit/language-specs/latex.lang b/moo/mooedit/language-specs/latex.lang index f4904f75..f50ce11a 100644 --- a/moo/mooedit/language-specs/latex.lang +++ b/moo/mooedit/language-specs/latex.lang @@ -101,6 +101,22 @@ \\[a-zA-Z]+ + + + + + + + + + + + + + + + + @@ -120,27 +136,43 @@ - + \$\$ \$\$ - - - + - + + \\\[ + \\\] + + + + + + + + \$ \$ - - - + + + + + + \\\( + \\\) + + + + diff --git a/moo/mooedit/language-specs/po.lang b/moo/mooedit/language-specs/po.lang index ec6294b1..aca20b90 100644 --- a/moo/mooedit/language-specs/po.lang +++ b/moo/mooedit/language-specs/po.lang @@ -41,6 +41,11 @@ + + + + [&_][a-zA-Z] +