Skip to content

Commit

Permalink
Fixed end of modeline handling (#3789)
Browse files Browse the repository at this point in the history
  • Loading branch information
mireq authored Dec 31, 2023
1 parent 2682bcb commit 3537174
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion options.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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);

Expand Down

0 comments on commit 3537174

Please sign in to comment.