Skip to content

Commit

Permalink
Respect filetype.common's wordchars if a filetype doesn't have its own
Browse files Browse the repository at this point in the history
Use filetype.common's wordchars instead of GEANY_WORDCHARS as default
for filetypes not having their own.  This allows to change the
wordchars for all filetypes at once.

Part of issue #492.
  • Loading branch information
b4n committed May 19, 2015
1 parent 93950a6 commit 40b9a2b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions data/filetypes.common
Expand Up @@ -97,6 +97,7 @@ calltips=call_tips
# which characters should be skipped when moving (or included when deleting) to word boundaries
# should always include space and tab (\s\t)
whitespace_chars=\s\t!\"#$%&'()*+,-./:;<=>?@[\\]^`{|}~
#wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789

[named_styles]
# This is the Default "built-in" color scheme
Expand Down
10 changes: 6 additions & 4 deletions src/highlighting.c
Expand Up @@ -171,10 +171,11 @@ static void get_keyfile_keywords(GKeyFile *config, GKeyFile *configh,
}


static void get_keyfile_wordchars(GKeyFile *config, GKeyFile *configh, gchar **wordchars)
static void get_keyfile_wordchars(GKeyFile *config, GKeyFile *configh, gchar **wordchars,
const gchar *default_wordchars)
{
*wordchars = utils_get_setting(string, configh, config,
"settings", "wordchars", GEANY_WORDCHARS);
"settings", "wordchars", default_wordchars);
}


Expand Down Expand Up @@ -578,7 +579,7 @@ static void styleset_common_init(GKeyFile *config, GKeyFile *config_home)
0, 0, &common_style_set.styling[GCS_LINE_HEIGHT]);

g_free(common_style_set.wordchars);
get_keyfile_wordchars(config, config_home, &common_style_set.wordchars);
get_keyfile_wordchars(config, config_home, &common_style_set.wordchars, GEANY_WORDCHARS);
g_free(whitespace_chars);
whitespace_chars = get_keyfile_whitespace_chars(config, config_home);
}
Expand Down Expand Up @@ -1054,7 +1055,8 @@ void highlighting_init_styles(guint filetype_idx, GKeyFile *config, GKeyFile *co
}

/* should be done in filetypes.c really: */
get_keyfile_wordchars(config, configh, &style_sets[filetype_idx].wordchars);
get_keyfile_wordchars(config, configh, &style_sets[filetype_idx].wordchars,
common_style_set.wordchars);
}


Expand Down

0 comments on commit 40b9a2b

Please sign in to comment.