diff options
Diffstat (limited to 'src/nvim/fileio.c')
-rw-r--r-- | src/nvim/fileio.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c index 24fe547e56..9d4c990f3a 100644 --- a/src/nvim/fileio.c +++ b/src/nvim/fileio.c @@ -1729,14 +1729,14 @@ failed: } } - if (set_options) - save_file_ff(curbuf); /* remember the current file format */ - - /* If editing a new file: set 'fenc' for the current buffer. - * Also for ":read ++edit file". */ - if (set_options) + if (set_options) { + // Remember the current file format. + save_file_ff(curbuf); + // If editing a new file: set 'fenc' for the current buffer. + // Also for ":read ++edit file". set_string_option_direct((char_u *)"fenc", -1, fenc, - OPT_FREE|OPT_LOCAL, 0); + OPT_FREE | OPT_LOCAL, 0); + } if (fenc_alloced) free(fenc); # ifdef USE_ICONV @@ -5878,19 +5878,20 @@ static int do_autocmd_event(event_T event, char_u *pat, int nested, char_u *cmd, is_buflocal = FALSE; buflocal_nr = 0; - if (patlen >= 7 && STRNCMP(pat, "<buffer", 7) == 0 + if (patlen >= 8 && STRNCMP(pat, "<buffer", 7) == 0 && pat[patlen - 1] == '>') { - /* Error will be printed only for addition. printing and removing - * will proceed silently. */ + /* "<buffer...>": Error will be printed only for addition. + * printing and removing will proceed silently. */ is_buflocal = TRUE; if (patlen == 8) + /* "<buffer>" */ buflocal_nr = curbuf->b_fnum; else if (patlen > 9 && pat[7] == '=') { - /* <buffer=abuf> */ - if (patlen == 13 && STRNICMP(pat, "<buffer=abuf>", 13)) + if (patlen == 13 && STRNICMP(pat, "<buffer=abuf>", 13) == 0) + /* "<buffer=abuf>" */ buflocal_nr = autocmd_bufnr; - /* <buffer=123> */ else if (skipdigits(pat + 8) == pat + patlen - 1) + /* "<buffer=123>" */ buflocal_nr = atoi((char *)pat + 8); } } |