summaryrefslogtreecommitdiff
path: root/buffer.c
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2023-03-02 09:53:11 -0500
committerpommicket <pommicket@gmail.com>2023-03-02 09:53:11 -0500
commit595cc50b7985ec67c49c6e2ffc649cb04692a318 (patch)
tree970ab71aadabc9f0f0a7a1634512c31aedd23188 /buffer.c
parent6d9ebc8332b6cc54ada4bc17689e4de4040892c6 (diff)
dynamic language registration working
Diffstat (limited to 'buffer.c')
-rw-r--r--buffer.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/buffer.c b/buffer.c
index 95cd3a3..5852c68 100644
--- a/buffer.c
+++ b/buffer.c
@@ -222,8 +222,9 @@ Language buffer_language(TextBuffer *buffer) {
// @TODO(optimization): cache this?
// (we're calling buffer_lsp on every edit and that calls this)
- if (buffer->manual_language >= 1)
- return (Language)(buffer->manual_language - 1);
+
+ if (buffer->manual_language != LANG_NONE)
+ return (Language)buffer->manual_language;
const Settings *settings = buffer->ted->default_settings; // important we don't use buffer_settings here since that would cause a loop!
const char *filename = path_filename(buffer->path);
size_t filename_len = strlen(filename);