summaryrefslogtreecommitdiff
path: root/buffer.c
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2022-11-02 19:58:20 -0400
committerpommicket <pommicket@gmail.com>2022-11-02 19:58:20 -0400
commit9d0433ba028792f5a468507dba28d406b9f758e7 (patch)
treef83f5db4b4d6e54ef70c252f624b108d40978ac6 /buffer.c
parentb070e5ce01c829bd101b1e0eda49f1e25d9d125c (diff)
fixed path-specific settings bugs. stuff seems to be working now
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;