Skip to content

Commit

Permalink
fix: suppress "is a directory" messages with shortmess 'F' (#18298)
Browse files Browse the repository at this point in the history
When 'F' is in 'shortmess', don't show messages when editing a
directory. This fixes a regression introduced by 0956283.

(cherry picked from commit c9f90ee)

Co-authored-by: Gregory Anders <greg@gpanders.com>
  • Loading branch information
github-actions[bot] and gpanders authored Apr 28, 2022
1 parent 9e5cef9 commit ef43e7d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/nvim/fileio.c
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,9 @@ int readfile(char_u *fname, char_u *sfname, linenr_T from, linenr_T lines_to_ski
// because reading the file may actually work, but then creating the
// swap file may destroy it! Reported on MS-DOS and Win 95.
if (after_pathsep((const char *)fname, (const char *)(fname + namelen))) {
filemess(curbuf, fname, (char_u *)_(msg_is_a_directory), 0);
if (!silent) {
filemess(curbuf, fname, (char_u *)_(msg_is_a_directory), 0);
}
msg_end();
msg_scroll = msg_save;
return NOTDONE;
Expand All @@ -379,7 +381,9 @@ int readfile(char_u *fname, char_u *sfname, linenr_T from, linenr_T lines_to_ski
#endif
) {
if (S_ISDIR(perm)) {
filemess(curbuf, fname, (char_u *)_(msg_is_a_directory), 0);
if (!silent) {
filemess(curbuf, fname, (char_u *)_(msg_is_a_directory), 0);
}
} else {
filemess(curbuf, fname, (char_u *)_("is not a file"), 0);
}
Expand Down

0 comments on commit ef43e7d

Please sign in to comment.