mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 11:28:22 +00:00
Merge pull request #32593 from zeertzjq/vim-9.1.1139
vim-patch:9.1.{1139,1141}
This commit is contained in:
@@ -305,6 +305,8 @@ int open_buffer(bool read_stdin, exarg_T *eap, int flags_arg)
|
|||||||
if (read_fifo) {
|
if (read_fifo) {
|
||||||
curbuf->b_p_bin = save_bin;
|
curbuf->b_p_bin = save_bin;
|
||||||
if (retval == OK) {
|
if (retval == OK) {
|
||||||
|
// don't add READ_FIFO here, otherwise we won't be able to
|
||||||
|
// detect the encoding
|
||||||
retval = read_buffer(false, eap, flags);
|
retval = read_buffer(false, eap, flags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -353,10 +353,9 @@ int readfile(char *fname, char *sfname, linenr_T from, linenr_T lines_to_skip,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!read_buffer && !read_stdin && !read_fifo) {
|
if (!read_stdin && fname != NULL) {
|
||||||
perm = os_getperm(fname);
|
perm = os_getperm(fname);
|
||||||
// On Unix it is possible to read a directory, so we have to
|
}
|
||||||
// check for it before os_open().
|
|
||||||
|
|
||||||
#ifdef OPEN_CHR_FILES
|
#ifdef OPEN_CHR_FILES
|
||||||
# define IS_CHR_DEV(perm, fname) S_ISCHR(perm) && is_dev_fd_file(fname)
|
# define IS_CHR_DEV(perm, fname) S_ISCHR(perm) && is_dev_fd_file(fname)
|
||||||
@@ -364,12 +363,15 @@ int readfile(char *fname, char *sfname, linenr_T from, linenr_T lines_to_skip,
|
|||||||
# define IS_CHR_DEV(perm, fname) false
|
# define IS_CHR_DEV(perm, fname) false
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (!read_stdin && !read_buffer && !read_fifo) {
|
||||||
if (perm >= 0 && !S_ISREG(perm) // not a regular file ...
|
if (perm >= 0 && !S_ISREG(perm) // not a regular file ...
|
||||||
&& !S_ISFIFO(perm) // ... or fifo
|
&& !S_ISFIFO(perm) // ... or fifo
|
||||||
&& !S_ISSOCK(perm) // ... or socket
|
&& !S_ISSOCK(perm) // ... or socket
|
||||||
&& !(IS_CHR_DEV(perm, fname))
|
&& !(IS_CHR_DEV(perm, fname))
|
||||||
// ... or a character special file named /dev/fd/<n>
|
// ... or a character special file named /dev/fd/<n>
|
||||||
) {
|
) {
|
||||||
|
// On Unix it is possible to read a directory, so we have to
|
||||||
|
// check for it before os_open().
|
||||||
if (S_ISDIR(perm)) {
|
if (S_ISDIR(perm)) {
|
||||||
if (!silent) {
|
if (!silent) {
|
||||||
filemess(curbuf, fname, _(msg_is_a_directory));
|
filemess(curbuf, fname, _(msg_is_a_directory));
|
||||||
|
@@ -60,6 +60,34 @@ func Test_read_fifo_utf8()
|
|||||||
call delete('Xtestout')
|
call delete('Xtestout')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_detect_fifo()
|
||||||
|
CheckUnix
|
||||||
|
" Using bash/zsh's process substitution.
|
||||||
|
if executable('bash')
|
||||||
|
set shell=bash
|
||||||
|
elseif executable('zsh')
|
||||||
|
set shell=zsh
|
||||||
|
else
|
||||||
|
throw 'Skipped: bash or zsh is required'
|
||||||
|
endif
|
||||||
|
let linesin = ['one', 'two']
|
||||||
|
call writefile(linesin, 'Xtestin_fifo', 'D')
|
||||||
|
let after = [
|
||||||
|
\ 'call writefile(split(execute(":mess"), "\\n"), "Xtestout")',
|
||||||
|
\ 'quit!',
|
||||||
|
\ ]
|
||||||
|
" if RunVim([], after, '<(cat Xtestin_fifo)')
|
||||||
|
if RunVim(['set shortmess-=F'], after, '<(cat Xtestin_fifo)')
|
||||||
|
let lines = readfile('Xtestout')
|
||||||
|
call assert_match('\[fifo\]', lines[0])
|
||||||
|
" call assert_match('\[fifo\]', lines[1])
|
||||||
|
else
|
||||||
|
call assert_equal('', 'RunVim failed.')
|
||||||
|
endif
|
||||||
|
|
||||||
|
call delete('Xtestout')
|
||||||
|
endfunc
|
||||||
|
|
||||||
func Test_detect_ambiwidth()
|
func Test_detect_ambiwidth()
|
||||||
CheckRunVimInTerminal
|
CheckRunVimInTerminal
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user