fix(api): vim.filetype.get_option() (#22753)

- Fix a bug in the cache
- Set some buffer options on the dummy buffer
This commit is contained in:
Lewis Russell
2023-03-22 16:49:04 +00:00
committed by GitHub
parent 3285cd6ecc
commit 28cfcf5126
2 changed files with 19 additions and 9 deletions

View File

@@ -111,6 +111,10 @@ static buf_T *do_ft_buf(char *filetype, aco_save_T *aco, Error *err)
// Set curwin/curbuf to buf and save a few things.
aucmd_prepbuf(aco, ftbuf);
set_option_value("bufhidden", 0L, "hide", OPT_LOCAL);
set_option_value("buftype", 0L, "nofile", OPT_LOCAL);
set_option_value("swapfile", 0L, NULL, OPT_LOCAL);
set_option_value("modeline", 0L, NULL, OPT_LOCAL); // 'nomodeline'
ftbuf->b_p_ft = xstrdup(filetype);