summaryrefslogtreecommitdiff
path: root/buffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'buffer.c')
-rw-r--r--buffer.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/buffer.c b/buffer.c
index d7e3062..036398b 100644
--- a/buffer.c
+++ b/buffer.c
@@ -277,13 +277,15 @@ static long context_score(const char *path, Language lang, const SettingsContext
long score = 0;
if (lang == context->language) {
- score += 100000;
+ score += 10000;
}
if (context->path) {
- int i;
- for (i = 0; i < TED_PATH_MAX && path[i] == context->path[i]; ++i);
- score += i;
+ if (path && str_has_prefix(path, context->path)) {
+ score += (long)strlen(context->path);
+ } else {
+ score -= 100000;
+ }
}
return score;