From 3537174e6cfb9beb9d4a122a8393993cc20e85ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Bend=C3=ADk?= Date: Sun, 31 Dec 2023 23:29:43 +0100 Subject: [PATCH] Fixed end of modeline handling (#3789) --- options.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/options.c b/options.c index 7341cc19c..3ef88b563 100644 --- a/options.c +++ b/options.c @@ -267,6 +267,7 @@ options_init_config(xdgHandle *xdg, char *execpath, char *configpath, int *init_ state = MODELINE_STATE_KEY_DELIM; break; case '\n': case '\r': + push_arg(&argv, key_buf, &pos); state = MODELINE_STATE_COMPLETE; break; default: @@ -291,7 +292,7 @@ options_init_config(xdgHandle *xdg, char *execpath, char *configpath, int *init_ break; /* Try the next line */ - if (((i == READ_BUF_MAX || file_buf[i+1] == '\0') && !feof(fp)) || state == MODELINE_STATE_INVALID) { + if (((i == READ_BUF_MAX || file_buf[i] == '\0') && !feof(fp)) || state == MODELINE_STATE_INVALID) { if (state == MODELINE_STATE_KEY || state == MODELINE_STATE_VALUE) push_arg(&argv, key_buf, &pos);