summaryrefslogtreecommitdiff
path: root/buffer.c
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2022-11-02 20:12:30 -0400
committerpommicket <pommicket@gmail.com>2022-11-02 20:12:30 -0400
commit760526ec4071f9392e5bfca77b19cb20f98c588e (patch)
treeaba49319680f0ddd430a85f743050d3529afcd10 /buffer.c
parent9d0433ba028792f5a468507dba28d406b9f758e7 (diff)
settings bugfixes, :insert-text, and a memory bugfix
the memory bug existed in the last release!
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;
}
}