summaryrefslogtreecommitdiff
path: root/buffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'buffer.c')
-rw-r--r--buffer.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/buffer.c b/buffer.c
index 036398b..4a54ff8 100644
--- a/buffer.c
+++ b/buffer.c
@@ -276,15 +276,21 @@ Language buffer_language(TextBuffer *buffer) {
static long context_score(const char *path, Language lang, const SettingsContext *context) {
long score = 0;
- if (lang == context->language) {
- score += 10000;
+ if (context->language) {
+ if (lang == context->language) {
+ score += 10000;
+ } else {
+ // dont use this. it's language-specific and for the wrong language.
+ return INT_MIN;
+ }
}
if (context->path) {
if (path && str_has_prefix(path, context->path)) {
score += (long)strlen(context->path);
} else {
- score -= 100000;
+ // dont use this. it's path-specific and for the wrong path.
+ return INT_MIN;
}
}