From 37b49b3920cbd2b317321371d860b0b0ff0b6730 Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Thu, 26 Aug 2010 21:06:23 +0400 Subject: [PATCH] Ticket #2324: fix of manually changing syntax definition. Signed-off-by: Andrew Borodin Signed-off-by: Slava Zanko --- src/editor/syntax.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/editor/syntax.c b/src/editor/syntax.c index bbd6f2fa2..ecff97946 100644 --- a/src/editor/syntax.c +++ b/src/editor/syntax.c @@ -1369,6 +1369,7 @@ get_first_editor_line (WEdit * edit) * Load rules into edit struct. Either edit or *pnames must be NULL. If * edit is NULL, a list of types will be stored into names. If type is * NULL, then the type will be selected according to the filename. + * type must be edit->syntax_type or NULL */ void edit_load_syntax (WEdit * edit, char ***pnames, const char *type) @@ -1379,7 +1380,14 @@ edit_load_syntax (WEdit * edit, char ***pnames, const char *type) if (option_auto_syntax) type = NULL; - edit_free_syntax_rules (edit); + if (edit != NULL) + { + char *saved_type; + + saved_type = g_strdup (type); /* save edit->syntax_type */ + edit_free_syntax_rules (edit); + edit->syntax_type = saved_type; /* restore edit->syntax_type */ + } if (!tty_use_colors ()) return;