diff options
Diffstat (limited to 'src/nvim/fileio.c')
-rw-r--r-- | src/nvim/fileio.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c index 26376afa27..90987d0b3d 100644 --- a/src/nvim/fileio.c +++ b/src/nvim/fileio.c @@ -1543,12 +1543,12 @@ rewind_retry: if (fileformat == EOL_UNKNOWN) { /* First try finding a NL, for Dos and Unix */ if (try_dos || try_unix) { - for (p = ptr; p < ptr + size; ++p) { - // Reset the carriage return counter. - if (try_mac) { - try_mac = 1; - } + // Reset the carriage return counter. + if (try_mac) { + try_mac = 1; + } + for (p = ptr; p < ptr + size; ++p) { if (*p == NL) { if (!try_unix || (try_dos && p > ptr && p[-1] == CAR)) @@ -6305,7 +6305,7 @@ bool has_event(int event) FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT /// @param force When true, ignore autocmd_busy /// @param group autocmd group ID or AUGROUP_ALL /// @param buf Buffer for <abuf> -/// @param exarg Ex command arguments +/// @param eap Ex command arguments /// /// @return true if some commands were executed. static bool apply_autocmds_group(event_T event, char_u *fname, char_u *fname_io, @@ -7106,6 +7106,7 @@ char_u * file_pat_to_reg_pat( char *allow_dirs, // Result passed back out in here int no_bslash // Don't use a backward slash as pathsep ) + FUNC_ATTR_NONNULL_ARG(1) { const char_u *endp; char_u *reg_pat; @@ -7118,6 +7119,10 @@ char_u * file_pat_to_reg_pat( if (pat_end == NULL) pat_end = pat + STRLEN(pat); + if (pat_end == pat) { + return (char_u *)xstrdup("^$"); + } + size_t size = 2; // '^' at start, '$' at end. for (p = pat; p < pat_end; p++) { |